I would like to make a navigation from Demo() to MainView(). After running on the Preview Provider, the Demo view is nested on the left hand side instead of showing an entire page. How to fix it?
Before clicking the icon:
After clicking the icon:
Here is my code:
struct Demo: View {
var body: some View {
NavigationView {
NavigationLink(destination: MenuView()) {
Text("Go")
}
}
}
}
You can use
.navigationViewStyle(.stack)
struct Demo: View {
var body: some View {
NavigationView {
NavigationLink(destination: MenuView()) {
Text("Go")
}
}
.navigationViewStyle(.stack)
}
}