In SwiftUI, how do I let two glass buttons morph into each other
Asked on 2025-09-12
1 search
To let two glass buttons morph into each other in SwiftUI, you can use the new Liquid Glass effects introduced in the WWDC 2025 sessions. Specifically, you can use the Glass Effect ID modifier to create fluid morphing transitions between glass elements. Here's a brief overview of how you can achieve this:
-
Declare a Local Namespace: Start by declaring a local namespace in your SwiftUI view.
-
Associate the Namespace: Associate this namespace with each of the glass effect elements you want to morph together. This includes the buttons and any other elements involved in the transition.
-
Use the Glass Effect ID Modifier: Apply the Glass Effect ID modifier to your elements. This will allow them to morph fluidly as they transition between states.
For more detailed guidance, you can refer to the session Build a SwiftUI app with the new design (20:40) where these concepts are discussed in the context of creating fluid morphing effects with the Liquid Glass material.

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.

Platforms State of the Union
Discover the newest advancements on Apple platforms.

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.