I created a very simple project with a NavigationStack and a NavigationLink as follows.
Code 1.
NavigationLink("Go To Next View", value: "TheView")
.navigationDestination(for: String.self) { val in
Text("Value = \(val)")
}
This code works fine in the simple project. But when I put this simple code into my existing app's project using a NavigationStack, it navigates to the next view fine, but there is no back button. I am updating my Apple Watch target to use SwiftUI and I want to use NavigationStack.
My app does use @ObservedObject and my important data is using @Publish in a singleton class which conforms to ObservableObject. But this NavigationLink code, Code 1, is extremely simple and should work fine, but it does not.
The same problem happens with the following code.
Code 2
NavigationLink { NextView() } label: {
MainRowView(rowText: "Saved")
}
When I switch to NavigationView, Code 1 is grayed out, but Code 2 works fine and has a back button. However, as you know, NavigationView is being deprecated, so I really need to fix this or have it fixed. I can't see how this could be a problem with my code as the code snippet is so simple and worked in the simple project.