Created
August 23, 2020 09:16
-
-
Save prafullakumar/916c04b6ff416321d9e7e4b4d1b78ca5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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