-
-
Save laevandus/39d43652d4c5e8b8e84c037e501d058f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@StateObject var viewModel = ViewModel() | |
var body: some View { | |
NavigationView { | |
List { | |
ForEach(viewModel.fruits) { item in | |
NavigationLink(item.name, tag: item.id, selection: $viewModel.selectedId) { | |
Text(item.name) | |
.navigationTitle(item.name) | |
} | |
} | |
} | |
.listStyle(.sidebar) | |
Text("No selection") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment