init(content: () -> Content)
Overview 概要
Use a Navigation
to create a navigation-based app in which the user can traverse a collection of views. Users navigate to a destination view by selecting a Navigation
that you provide. On iPadOS and macOS, the destination content appears in the next column. Other platforms push a new view onto the stack, and enable removing items from the stack with platform-specific controls, like a Back button or a swipe gesture.
Use the init(content:)
initializer to create a navigation view that directly associates navigation links and their destination views:
NavigationView {
List(model.notes) { note in
NavigationLink(note.title, destination: NoteEditor(id: note.id))
}
Text("Select a Note")
}
Style a navigation view by modifying it with the navigation
view modifier. Use other modifiers, like navigation
, on views presented by the navigation view to customize the navigation interface for the presented view.