SwiftUI NavigationLink. No back button on destination view

I’m using a simple NavigationLink but the destination view does not have a back button. I’ve searched the internet, etc. and tried setting navigationbarhidden to false in the destination view. Tried adding padding to top in case the bar was off the top of the viewable area. Then I added a trailing navigation bar item, which displayed, but the back button did not. Any suggestions are greatly appreciated.

Here’s my code:

NavigationLink(destination: NewUserView()){
                    HStack {
                        Text("New User?").font(.system(size:20, weight: .light)).foregroundColor(.primary)
                        Text("Create User Profile").font(.system(size: 20, weight: .semibold)).foregroundColor(.green)
                    }

i remember that it might have something to do with the new swiftui navigation where it kinda opens when you swipe instead of pressing a back button

try looking at properties to see if anything seems off

I’ve tried: 1) remove all modifiers from navigationLink 2) make destination just Text(“Next Screen”), 3) make calling view only have the navigationLink inside a navigationView.

It works fine when I click the NavigationLink and opens the destination view, but there is no back button. I have another NavigationLink on another view that works just fine and displays a back button on the destination view. It’s very frustrating.

I’ve resolved the issue. The NavigationLink was created from a root view and the root view NavigationView was off the top of the view so the back button was not visible.

1 Like