How can I hide navigation bars (or back button) with NavigationStack?

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?

Replies

I found that the code below works well, without the Back button in the navigated view (SigninView).

            NavigationStack(path: $path) {
                SplashView()
                    .navigationDestination(for: SigninState.self) { state in
                        Group {
                            switch state {
                            case .notsignedin:
                                SigninView()
                            case .signedin:
                                MainView()
                            }
                        }
                        .navigationBarBackButtonHidden(true)
                    }
            }

I though I tried this pattern, but probably I made a mistake in the past. Anyway, my question was invalid, and I could hide the Back button within NavigationStack.