Contents

navigationBarBackButtonHidden(_:)

Hides the navigation bar back button for the view.

Declaration

nonisolated func navigationBarBackButtonHidden(_ hidesBackButton: Bool = true) -> some View

Parameters

  • hidesBackButton:

    A Boolean value that indicates whether to hide the back button. The default value is true.

Discussion

Use navigationBarBackButtonHidden(_:) to hide the back button for this view.

This modifier only takes effect when this view is inside of and visible within a NavigationStack or a NavigationSplitView in narrow size classes.

The example below demonstrates how to hide the navigation back button for a view within a navigation stack:

NavigationStack {
   List {
       NavigationLink("Mint") {
           Color.mint
               .navigationBarBackButtonHidden()
       }
   }
   .navigationTitle("Colors")
}

See Also

Configuring the navigation bar