NavigationStack
-
A data struct with information for a transition animation used by the
See moreNavigationStackView.Declaration
Swift
public struct NavigationAnimation -
A concrete type of navigation model which uses strings as identifier.
Declaration
Swift
public typealias NavigationModel = NavigationStackModel<String> -
The underlying
NavigationStackView‘s model which can be manipulated to apply the navigation transitions.This class is generic to provide the possibility to use a different type as identifier. However, normally you want to bound the identifier’s type simply to a string. For this you can also just use
NavigationModel.An instance of this model has to be injected into the view hierarchy as an environment object:
See moreMyRootView().environmentObject(NavigationModel())Even when using multiple navigation stack views in a view hierarchy there has to be always only one instance ofNavigationModel. The model can be used with identifiers to target specific navigation stack views.Declaration
Swift
public class NavigationStackModel<IdentifierType> : ObservableObject where IdentifierType : Equatableextension NavigationStackModel: CustomDebugStringConvertible -
The navigation view used to switch content when applying a navigation transition.
This view works similar to SwiftUI’s
NavigationView. Place it as the view’s root and provide the default content to show when no navigation transition has been applied. Use theNavigationModelto provide a destination view and transition animation to navigate to.See moreImportant
A single instance of theNavigationModelhas to be injected into the view hierarchy as an environment object:MyRootView().environmentObject(NavigationModel())Declaration
Swift
public struct NavigationStackView<IdentifierType> : View where IdentifierType : Equatable
View on GitHub
NavigationStack Reference