How do I apply .glassEffectID("eraser", in: namespace) in uikit
Asked on 2026-03-05
1 search
To apply the .glassEffectID("eraser", in: namespace) in UIKit, you would need to use the new Liquid Glass design system introduced by Apple. While the specific method .glassEffectID("eraser", in: namespace) is not directly applicable in UIKit, you can achieve similar effects using the new UI Visual Effect View and the Liquid Glass material.
Here's a general approach based on the information from the WWDC sessions:
-
Create a UI Visual Effect View: This is the starting point for adding glass effects in UIKit. You can configure this view to use the new Liquid Glass material.
-
Configure the Glass Effect: Use the new APIs to customize the appearance of the glass, such as its shape and interaction properties. You can animate the glass effect to appear or disappear using a special materialized animation.
-
Add Content: Use the content view of the UI Visual Effect View to add labels, images, or other UI elements. These elements will automatically adapt to the glass effect, becoming vibrant based on their text color.
-
Interactive Elements: If you want interactive elements like buttons to react to user interactions, set
isInteractiveto true on the glass effect.
For more detailed guidance, you can refer to the session Build a UIKit app with the new design (19:15) which covers custom elements and how to integrate them with the new design system.

Build a UIKit app with the new design
Update your UIKit app to take full advantage of the new design system. We’ll dive into key changes to tab views, split views, bars, presentations, search, and controls, and show you how to use Liquid Glass in your custom UI. To get the most out of this video, we recommend first watching “Get to know the new design system” for general design guidance.

Build a SwiftUI app with the new design
Explore the ways Liquid Glass transforms the look and feel of your app. Discover how this stunning new material enhances toolbars, controls, and app structures across platforms, providing delightful interactions and seamlessly integrating your app with the system. Learn how to adopt new APIs that can help you make the most of Liquid Glass.

What’s new in UIKit
Modernize your app with the latest APIs in UIKit, including enhanced menu bar support, automatic observation tracking, a new UI update method, and improvements to animations. We’ll also cover how you can include SwiftUI scenes in your UIKit app and explore SF Symbols, HDR color pickers, and more.
