(If any Apple folks see this - I filed a feedback: FB8910881)
I am trying to build a an SwiftUI app with a layout similar to the Apple Music app - Artist Page or like in the SwiftUI tutorial from Apple (Landmarks app). Inside the app you can scroll vertically over list items and horizontally over all the rows.
In my app I have a list of rows inside a ScrollView (vertical). The rows itself scrolls vertical and contain a ScrollView and an LazyHGrid. It works on iOS but not on macOS.
On iOS I can scroll vertically through the list and horizontally through the row-items - in the Simulator you click and drag to scroll inside the app - works like a charm.
On macOS however I can only scroll vertically if I am not over a row... I scroll via the magic mouse up/down/left/right. The row's Scrollview seems to catch the vertical scrolling... In the Apple Music app you can scroll up and down and left and right if you over the Artist Playlist row.
Xcode 12.2 and Xcode 12.3 beta, macOS BigSur 11.0.1
Here is my code:
import SwiftUI
struct ScrollViewProblem: View {
var body: some View {
ScrollView {
HStack {
Text("Scrolling Problem")
.font(.largeTitle)
Spacer()
}.padding()
ScrollRow()
ScrollRow()
ScrollRow()
ScrollRow()
}
}
}
struct ScrollRow: View {
let row = [
GridItem(.flexible(minimum: 200))
]
var body: some View {
VStack {
HStack {
Text("Row")
.font(.largeTitle)
Spacer()
}
ScrollView(.horizontal) {
LazyHGrid(rows: row, spacing: 20) {
ForEach(1..<7) { index in
Rectangle()
.fill(Color.blue)
.frame(width: 200, height: 200)
}
}
}
}
.padding()
}
}
struct ScrollViewProblem_Previews: PreviewProvider {
static var previews: some View {
ScrollViewProblem()
}
}



