Home > Net >  XCode IOS How to get rid of the back button on home screen?
XCode IOS How to get rid of the back button on home screen?

Time:07-22

I have a project with NavigationLink that leads a login screen into a main menu which is intended, but there is a back button that leads back to the login screen which I want to get rid of. How would I do so?

CodePudding user response:

Under the view that you are presenting in the main menu, for instance:

var body: some View {
    MyView()
        .navigationBarBackButtonHidden()
}

if you have a more complicated view, you can also put it under the layout container, like:

var body: some View {
    HStack {
        // Your views
    }
    .navigationBarBackButtonHidden()
}

Your back button should be gone then.

Kind regards, MacUserT

  • Related