Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created June 23, 2022 16:48
Show Gist options
  • Save anupamchugh/8047c61a56b386113c43bc2bca6af3d7 to your computer and use it in GitHub Desktop.
Save anupamchugh/8047c61a56b386113c43bc2bca6af3d7 to your computer and use it in GitHub Desktop.
final class Router: ObservableObject {
@Published var path = NavigationPath()
}
struct ContentView: View {
@EnvironmentObject var router: Router
var body: some View {
NavigationStack(path: $router.path) {
RowListsView()
.navigationDestination(for: Int.self) { i in
RowListsView()
}
}
.environmentObject(router)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment