One article is saying:
UITouch/UIEvent is created
UIApplication.shared.sendEvent() sends the event to a queue
The event goes directly to the view's UIGestureRecognizer or UIResponder
Second article says:
An event is created
The hit-test is performed on the view that was touched
UIApplication.shared.sendEvent(_:)
UIWindow.sendEvent(_:)
UIGestureRecognizer
Hit-test happens again?
UIResponder
An event is created
UIApplication manages the queue of UIEvents
UIWindow performs the hit test. I'm guessing this is done by UIWindow.sendEvent(_:)?
UIApplication.shared.sendEvent(_:) sends the event to the first responder
The event is handled by the gesture recognizer or the responder
An event is created
The event is handed to an instance of UIApplication through UIApplication.shared.sendEvent(_:)
UIWindow gets the event through UIWindow.sendEvent(_:)
UIWindow performs the hit-tests on the view hierarchy as well as the UIResponder
What I'm confused about is:
When do the hit-tests of the view hierarchy happen?
What exactly does UIApplication.shared.sendEvent(_:) do? The definition says "Dispatches an event to the appropriate responder objects in the app", but this means that the UIEvent has to already know the touched view associated with it, which means this method has to be invoked after the hit-tests. But, none of the above resources say that UIApplication.shared.sendEvent(_:) happens AFTER the hit-tests.
The definition of UIWindow.sendEvent(_:) says that it's for dispatching the event to a view (and not a responder like UIApplication.shared.sendEvent(_:)). I'm not exactly sure what the difference is. And does this happen before or after the hit-tests?
What is this "queue" they keep referring to? Is it the queue to be sent to the instance of UIApplication or the responders or to UIWindow or to perform hit-tests?