Skip to content

Instantly share code, notes, and snippets.

@prafullakumar
Created August 23, 2020 09:16
Show Gist options
  • Save prafullakumar/916c04b6ff416321d9e7e4b4d1b78ca5 to your computer and use it in GitHub Desktop.
Save prafullakumar/916c04b6ff416321d9e7e4b4d1b78ca5 to your computer and use it in GitHub Desktop.
struct CustomBackOnNavigation: View {
var body: some View {
NavigationView {
NavigationLink(destination : DestinationView()) {
Text("Custom Back Nav")
}
.navigationBarTitle("Custom Back Nav")
}
}
}
struct DestinationView : View {
@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
var body : some View {
Text("Destination View")
.navigationBarTitle("Destination View")
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: Button(action : {
self.presentationMode.wrappedValue.dismiss()
}){
HStack {
Image(systemName: "arrow.left")
Text("Back")
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment