I'm using NavigationStack and struggling with Navigationslinks on second SubView depth.
struct ContentView: View {
var body: some View {
NavigationStack {
VStack {
Text("I'm a MainView").font(.title2).padding()
NavigationLink {
SubChild1()
} label: {
Text("Goto SubView 1").font(.title3)
}
Spacer()
}
}
}
}
struct SubChild1: View {
var body: some View {
VStack {
Text("I'm SubView 1").font(.title2)
.padding()
NavigationLink {
SubChild2()
} label: {
Text("Goto SubView 2").font(.title3)
}
Spacer()
}
}
}
struct SubChild2: View {
var body: some View {
VStack {
Text("I'm a SubView 2").font(.title2).padding()
Spacer()
}
}
}
When I navigate to Subview 1, animation work. If I navigate then to Subview2 the view appear immediately without animation. The "Back" link on upper left corner navigates back to the root main view controller instead of subview 1. Did I miss something or is that a known "feature"?