I come from macOS/Cocoa & Mouse Events, and I'm trying to get a hang of these "Finger"(my own name for it) events
My question is:
When a "Finger" event is happening on a UIView
(let's call MyView
), when does it get sent as a Gesture
to a UIGestureRecognizer
on MyView
, and when does it get sent as a touchesBegan/touchesMoved/touchesEnded
to MyView
I have searched with all possible queries I could think of, and really only found a few decent sources, but nothing that answers exactly what I'm looking for
touchesBegan, touchesEnded, touchesMoved for moving UIView
UIGestureRecognizers vs touchesBegan/touchesMoved/touchesEnded (accuracy)
My best guess right now is that the difference between touchBegan/touchMoved/touchEnded and a Gesture recognizer depends on the speed of the finger?
So if you tap, and slowly move, the underlying UIView
receives the touchMoved
events. If you Tap and drag quickly, a gesture is created and passed to the the GestureRecognizer of the underlying UIView
My current guess is that when the finger touches down, event runloop detects this finger, and fires a touchesBegan
. As you move your finger around, it fires touchesMoved
.
However, if you are moving quickly enough, or in a way that the runtime thinks that you're making a gesture, it instead creates a Gesture and fires a message to the UIGestureRecognizer
, instead of sending touchesMoved
I am currently trying to test out this hypothesis, but it's pretty tedious and I don't have a really good sample project to test with, so I figured I'd crowdsource some insight if possible. I'll report back if I figure it out myself as well