To hide the back button:
.navigationBarBackButtonHidden(true)
struct SampleDetails: View {
var body: some View {
List {
Text("sample code")
}
.navigationBarBackButtonHidden(true)
}
}
where SampleDetails is the view you navigate to.
If you want a back button with just a plain "<":
https://stackoverflow.com/questions/56571349/custom-back-button-for-navigationviews-navigation-bar-in-swiftui
struct SampleDetails: View {
@Environment(\.presentationMode) var presentationMode: Binding
var btnBack : some View { Button(action: {
self.presentationMode.wrappedValue.dismiss()
}) {
HStack {
Image("ic_back") // set image here
.aspectRatio(contentMode: .fit)
.foregroundColor(.white)
Text("<")
}
}
}
var body: some View {
List {
Text("sample code")
}
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: btnBack)
}
}