The Question
When the user taps on a view which of these two functions is called first? touchesBegan(_:with:)
or point(inside:with:)
.
The Context
I want to subclass a PKCanvasView (which inherits from UIScrollView) to allow interaction through the view (i.e. allow interaction to the view below and disable interaction to the PKCanvasView) when the point of the touch is outside of the UIBezierPath
of a stroke on the canvas.
This is easy enough by overriding point(inside:with:)
. My issue lies in the fact that I only want to allow interaction to the view below if the touch event UITouch.TouchType
is not an apple pencil : .pencil
. (so that the user can draw with the apple pencil and interact with the view below using their finger)
The only way I think can get this information is by also overriding touchesBegan(_:with:)
. Here I can access the event and its touch type. I would then somehow pass this to be read inside of point(inside:with:)
.
However, that all relies on extracting the UITouch.TouchType
information before I check if the touch point is overlapping with any PKStroke
paths.
So: Is touchesBegan(_:with:)
called before point(inside:with:)
?