Concept

  • NavigationStack creates a navigation context for your views.
  • NavigationLink is used to push a new view onto the stack when tapped.

Example

NavigationStack {
    List(items, id: \.self) { item in
        NavigationLink(destination: DetailView(item: item)) {
            Text(item)
        }
    }
}

Sources