I'm creating a new simple app, and want to navigate from a view to another without Back button because the boundary of those two views should be non-interactive for users.
But, with NavigationStack, I cannot hide the back button (nor the whole navigation bar). I tried the code below:
NavigationStack(path: $path) {
SplashView()
.navigationBarTitleDisplayMode(.automatic)
.navigationBarBackButtonHidden(true)
.navigationDestination(for: SigninState.self) { state in
Group {
switch state {
case .notsignedin:
SigninView()
case .signedin:
MainView()
}
}
}
}
}
.navigationBarBackButtonHidden()
is documented that it only takes effect for NavigationView.
I also tried .toolbar(.hidden, for: .navigationBar)
, but it also didn't work as expected.
Are there any way to hide the navigation bar or the back button within NavigationStack?