NavigationStackView
public struct NavigationStackView<IdentifierType> : View where IdentifierType : Equatable
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 the NavigationModel
to provide a destination view and transition animation to navigate to.
Important
A single instance of theNavigationModel
has to be injected into the view hierarchy as an environment object:
MyRootView().environmentObject(NavigationModel())
-
Initializes the navigation stack view with a given ID and its default content.
Declaration
Swift
public init<Content>(_ identifier: IdentifierType, @ViewBuilder defaultView: @escaping () -> Content) where Content : View
Parameters
identifier
The navigation stack view’s ID. This is the reference ID to use when applying a navigation via the model and targeting this layer of stack.
defaultView
The content view to show when no navigation has been applied.
-
Declaration
Swift
public var body: some View { get }