Glass containers

Asked on 2025-06-11

1 search

Glass containers, specifically referred to as "glass effect containers," are used in app design to group multiple glass elements together. This grouping is essential for achieving visual consistency and improving performance. The glass effect container allows these elements to share their sampling region, which provides a more consistent visual result and requires only one sampling pass for the entire group. This is particularly useful because glass elements cannot directly sample other glass elements, which would otherwise lead to inconsistent visual results.

For example, in the session "Build an AppKit app with the new design," it is explained that using a glass effect container allows multiple glass shapes to fluidly join and separate using a liquid visual effect. This is achieved by creating an NS glass effect container view and setting the stack view as its content view. The container and its content view are constrained together using auto layout, which allows for a clean integration into existing layouts.

Similarly, in the session "Build a SwiftUI app with the new design," the use of a glass effect container is demonstrated to group badges in the Landmarks app, allowing for fluid morphing transitions.

For more detailed information, you can refer to the Build an AppKit app with the new design (17:30) session.