I am trying to implement nested scroll views in SwiftUI. Consider the following minimal example:
struct ContentView: View {
var body: some View {
ScrollView {
VStack {
ForEach(Array(1...7), id: .self) { section in
ScrollView(.horizontal) {
HStack {
ForEach(Array(1...10), id: .self) { section in
Rectangle()
.fill(.blue)
.frame(width: 100.0, height: 150.0)
}
}
}
}
}
}
}
}
It seems to work okay however I have noticed that if any of the horizontal scroll views are scrolling then the vertical scroll locks ups. This makes it very difficult to scroll the content naturally. How can I fix this?