Post

Replies

Boosts

Views

Activity

Reply to How to share @Namespace between views
Passing animation namespaces across NavigationView transitions is not possible as of Xcode 12 beta 2, but this might change in the future. The same is also true for sheets. More generally, when you use @Namespace the property you create automatically has the type Namespace.ID, which you pass between views freely. For example, in your parent view (the one hosting whatever views you are animating), you might start by creating a namespace like this: @Namespace var animation. You could then create separate SwiftUI views that store an externally injected namespace like this:struct ChildView: View { let animation: Namespace.ID } And finally you can pass the parent namespace into the child for use with matchedGeometryEffect() like this:ChildView(animation: animation) This way multiple independent SwiftUI views can share the same animation namespace.
Jul ’20