Skip to content

Instantly share code, notes, and snippets.

@nbhasin2
Created April 3, 2023 00:17
Show Gist options
  • Save nbhasin2/8a0ad13bbfe30a13b5974250fd9ab574 to your computer and use it in GitHub Desktop.
Save nbhasin2/8a0ad13bbfe30a13b5974250fd9ab574 to your computer and use it in GitHub Desktop.
NavigationStack: NavStackDestinationContentView Example
struct NavStackDestinationContentView: View {
let cars: [Car]
let viewType: ViewType = .navigationStackDestination
var body: some View {
NavigationStack {
List(cars) { car in
NavigationLink(car.rawValue, value: car)
}
.navigationBarTitleDisplayMode(.inline)
.navigationTitle(viewType.title)
.navigationDestination(for: Car.self) { car in
CarDetailView(car: car)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment