How do I animate between pages
Generated on 8/3/2024
1 search
To animate between pages, you can use the new Zoom transition introduced in iOS 18. This transition allows a cell to morph into the incoming view, providing a sense of continuity by keeping the same UI elements on screen across the transition. The Zoom transition is continuously interactive, meaning you can grab and drag it around from the beginning or during the transition.
Here's a brief overview of how to implement it:
- Opt into the Zoom Transition: Add the
navigationTransitionStyle
modifier to the presented view and specify the Zoom transition. - Connect the Modifier to a Source View: This tells the system which view to zoom from.
For a detailed explanation and code example, you can refer to the session Enhance your UI animations and transitions at the timestamp 00:01:49.
Additionally, the session Create custom visual effects with SwiftUI covers various view transitions, including how to chain multiple transitions for more complex animations. This can be useful if you want to add more effects to your page transitions.
Relevant Sessions
Enhance your UI animations and transitions
Explore how to adopt the zoom transition in navigation and presentations to increase the sense of continuity in your app, and learn how to animate UIKit views with SwiftUI animations to make it easier to build animations that feel continuous.
Create custom visual effects with SwiftUI
Discover how to create stunning visual effects in SwiftUI. Learn to build unique scroll effects, rich color treatments, and custom transitions. We’ll also explore advanced graphic effects using Metal shaders and custom text rendering.
Platforms State of the Union
Discover the newest advancements on Apple platforms.