SwiftUI NavigationButton within navigationBarItems
As I told you in comments, It was a bug. But it get fixed and it's working now exactly as you expected since Beta 5, But remember, NavigationButton
has changed to NavigationLink
. So it would be like:
struct ContentView: View {
var body: some View{
NavigationView {
Text("Hello world")
.navigationBarTitle(Text("Title"))
.navigationBarItems(trailing:
NavigationLink(destination: TestView()) {
Text("Next")
}
)
}
}
}