Can I make a window be made of glass material?

Asked on 06/16/2025

1 search

Yes, you can make a window be made of glass material using Apple's new Liquid Glass material. This material is designed to create a translucent, dynamic effect that behaves like real glass. It can be used in both AppKit and SwiftUI applications to enhance the visual hierarchy and provide a distinct functional layer for controls and navigation.

For AppKit, you can use the NSGlassEffectView to apply the Liquid Glass material to your window or specific UI elements. This involves creating an NSGlassEffectView for each glass element you want to display and setting its content view property to the desired view. You can also group multiple glass elements using an NSGlassEffectContainerView to ensure a consistent visual result and improve performance.

For SwiftUI, you can use the container background modifier to replace the window background color with a material that resembles frosted glass, allowing color from the desktop to shine through.

For more details on how to implement this, you can refer to the session Build an AppKit app with the new design (17:30) and Tailor macOS windows with SwiftUI (03:53).