I have been testing this simple SwiftUI code: It has a list in ContentView shown below. When a cell of the list is tapped, it pushes a SecondList into the navigation stack.
When this SwiftUI code was run on a real iPad with a trackpad, I used 2-finger swipe to scroll the list up and down. In the Simulator, I enabled "Capture Pointer" to simulate a mouse. The list in the ContentView scrolls smoothly. However, for theSecondList, it freezes randomly and thereafter not responding.
It also failed in a UIKit project, where I replaced a UINavigationView with this ContentView using UIHostingViewController.
It was testing it with iPadOS 14.5 on both Simulator and iPad Pro hardware with Magic Keyboard.
How do I fix this? Is this an OS bug?
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
List {
ForEach(0..30, id: \.self) { index in
NavigationLink(
destination: SecondList(),
label: {
Text(String(index))
})
}
}
}.navigationViewStyle(StackNavigationViewStyle())
}
}
struct SecondList: View {
var body: some View {
List {
ForEach(0..30, id: \.self) { index in
Text(String(index))
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}