Search code examples
iosswiftwatchkitswiftui

SwiftUi: remove "Back" button from a detail view in WatchKit


Is there a way to remove the "Back" button from a detail view in WatchKit if the view has been pushed by a NavigationLink?

enter image description here


Solution

  • How about .navigationBarBackButtonHidden(true)?

    PS: the modifier should be set inside of the detail view's body property to make it work and not on NavigationLink itself.

    Ref: https://developer.apple.com/documentation/swiftui/navigationlink/3337140-navigationbarbackbuttonhidden