Here I have a view A, B, and C which have the following definitions and navigation flow. Here how can I go from view C to directly A by dismissing both B and C?
I am using this code to dismiss view C and B
@Environment(\.presentationMode) var presentationMode
presentationMode.wrapedValue.dismiss(
)
how can I dismiss at once? dismissing one by one makes the user experience quite disappointing ios : 13+
struct A: View {
var body: some View {
NavigationView {
VStack {
NavigationLink(destination: B()) {
Text("Go to B")
}
}
}
}
}
struct B: View {
var body: some View {
VStack {
Text("This is view B")
NavigationLink(destination: C()) {
Text("Go to C")
}
}
}
}
struct C: View {
var body: some View {
Text("This is view C")
}
}