struct ContentView: View { @State private var path = NavigationPath() var body: some View { NavigationStack(path: $path) { Button { path.append("NewView") } label: { Text("Show NewView") } .navigationDestination(for: String.self) { view in if view == "NewView" { Text("This is NewView") } } } } }