SwiftUI Problem with view navigation

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()
    }
}

You can use a NavigationLink without also having the NavigationView. Something like:

    NavigationLink(destination: ChildView()) {
        Text("Go There")
    }

will work standalone.

Is that still accurate? When I try to use NavigationLink outside a NavigationView, the NavigationLink does not function.

Looks like a change in the release version. It probably wasn’t supposed to work in the beta and the “bug” was fixed.

If you need to show a new view without navigation, then a modal would probably be your best option.