ScrollView does not respect DragGesture passed to simultaneousGesture modifier

Hi! I've got a ScrollView with a VStack inside mocking vertical subviews layout that could be written using CollectionView in UIKit.

My goal was to know in which direction user is scrolling ScrollView, so I've decided to add DragGesture to a ScrollView, but looks like its internal DragGestures are blocking my custom DragGesture.


Here's the minimal code reproducing this issue:

struct ExperimentView: View {
    var body: some View {
        ScrollView {
            VStack {
                ForEach(0..<50) { number in
                    Text("\(number)")
                        .frame(width: 100, height: 100)
                        .background(Color.blue)
                }
            }
        }
        .simultaneousGesture(DragGesture().onChanged({ value in
            print(value.translation)
        }), including: .all)
    }
}


I've tried different masks and different parameters of DragGesture itself. What's happening when I'm trying to scroll touching the blue views:
1. in case ScrollView is steady during initial touch of DrugGesture - onChange will get called only once
2. in case ScrollView is scrolling itself due to inertia during initial touch of DrugGesture - onChange will not get called
Interesting thing is that closure is getting called absolutely correctly (at least as I expect this code to work) when I'm dragging about 5-10pt on a white background near the blue views, but not on them... and in this case the ScrollView is not moving, obviously. Tried TapGesture instead of DragGesture and taps are recognised 100% as expected.


Is this a bug or a feature? What am I doing wrong? Checked on Xcode 11 Beta 2 and 3 and macOS Catalina Beta 2 and 3

Replies

I'm seeing the same problem in beta 3. I have still not found a way to resolve this. Have you?