I\'ve got a basic view with a button using SwiftUI and I\'m trying to present a new screen/view when the button is tapped. How do I do this? Am I suppose to create a delegat
if don't want to show the navigationView you can hide it in destination.
struct ContentViewA : View {
var body: some View {
NavigationView {
VStack {
Text("Hello World")
NavigationLink(destination: ContentViewB()) {
Text("Go To Next Step")
}
}
}
}
}
struct ContentViewB : View {
var body: some View {
NavigationView {
VStack {
Text("Hello World B")
}.navigationBarTitle("")
.navigationBarHidden(true)
}
}
}
or if you want to hide it based on conditions you can use @State for changing the visibility.