Hello, I hope this message finds you well. I am learning SwiftUI.
All I want to do at this stage is navigate between two views without using the NavigationView.
How might I adjust my code to allow me to click on the button in each view to move between views?
import SwiftUI
struct ContentView: View {
var body: some View {
// When the user taps this I want them to go to DetailView
Button(action: {}) {
Text(“If you tap me I go to DetailView”)
}
}
}
struct DetailView: View {
var body: some View {
Button(action: {}) {
Text("If you tap me I go back to ContentView ")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}