SwiftUI Custom Back Button Text for NavigationView SwiftUI Custom Back Button Text for NavigationView xcode xcode

SwiftUI Custom Back Button Text for NavigationView


Full Code:

struct SampleDetails: View {    @Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>    var btnBack: some View {        Button(action: {self.presentationMode.wrappedValue.dismiss()}) {            HStack {                Image("ic_back") // set image here                .aspectRatio(contentMode: .fit)                .foregroundColor(.white)                Text("Go back")            }        }    }    var body: some View {        List {            Text("sample code")        }        .navigationBarBackButtonHidden(true)        .navigationBarItems(leading: btnBack)    }}

For more clarification click here.