SwiftUI 3
navigation link doesn't work after pop if stack size > 1
Steps to reproduce:
- Launch the app
- Tap any row in list #1
- Tap any row in list #2
- Tap
Back
- Tap any row in list #2
Result: nothing happens, navigation link doesn't work Expected result: I should see view controller #3 again.
Works fine in SwiftUI 2
though.
Was anyone able to make nested NavigationLinks
work in Swift UI 3? I have filed an error report to Apple.
import SwiftUI
@main
struct NavigationTestApp: App {
var body: some Scene {
WindowGroup {
FirstView()
}
}
}
struct FirstView: View {
var body: some View {
NavigationView {
List {
ForEach(0..<10) { i in
NavigationLink(destination: SecondView()) {
Text("Row \(i)")
.padding()
}
}
}
.navigationTitle(Text("1"))
}
}
}
struct SecondView: View {
var body: some View {
List {
ForEach(0..<10) { i in
NavigationLink(destination: ThirdView()) {
Text("Child \(i)")
.padding()
}
}
}
.navigationTitle(Text("2"))
}
}
struct ThirdView: View {
var body: some View {
VStack {
Text("")
}
.navigationTitle(Text("3"))
}
}