UIScrollView does not give touches to subview if drag starts quickly

I have a UIScrollView, and its subview inside needs to respond to some touchesMoved events without scrolling. I've got it mostly working, but with one sticking point that confuses the user: if I touch and quickly move my finger, then the UIScrollView takes the gesture as a scroll, and never calls the touchesBegan, touchesMoved, etc., of its subview. However, if I touch, then pause for a bit, then drag, then things work as intended: the subview gets touchesBegan, touchesMoved, etc., and things are handled without any scrolling.

On my UIScrollView, I've set:

delaysContentTouches = false
canCancelContentTouches = true

And I've overrode touchesShouldCancel(in view: UIView). But that does not get called in the case when I quickly drag my finger.

Is there something else I need to do?

Answered by rnikander in 705443022

My problem was caused by something dumb that I left out of my question, because I was trying to simplify it to post here.

My UIScrollView was actually inside a SwiftUI view hierarchy, using UIViewRepresentable. Higher in that view hierarchy, there was a SwiftUI List, which also has scrolling. I had forgotten about that List because I was using it for it's layout appearance, grouping items into sections, but not for its scrolling. Once I got rid of that List, everything worked as expected.

Accepted Answer

My problem was caused by something dumb that I left out of my question, because I was trying to simplify it to post here.

My UIScrollView was actually inside a SwiftUI view hierarchy, using UIViewRepresentable. Higher in that view hierarchy, there was a SwiftUI List, which also has scrolling. I had forgotten about that List because I was using it for it's layout appearance, grouping items into sections, but not for its scrolling. Once I got rid of that List, everything worked as expected.

UIScrollView does not give touches to subview if drag starts quickly
 
 
Q