It seems like you just want both of those gesture recognizers to work simultaneously. Just implement UIGestureRecognizerDelegate
for your parentView
and make it tapGestureRecognizer
's and gestureRecognizerA
's delegate. Then implement an optional method there:
// MARK: - UIGestureRecognizerDelegate
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) {
return true
}
That might be able to detect a tap in subView
even while doing a circular motion within parentView
.
UPDATE: When using gesture recognizers, "forwarding touches" would be to simply calling a method of another recognizer. Just put a recognizer which is doing the forwarding as its parameter.
For instance, tapGestureRecognizer
fires viewWasTapped(_ sender: UITapGestureRecognizer)
when a tap is detected. Now, when your gestureRecognizerA
wants to forward its events to tapGestureRecognizer
, it simply does so by calling:
subView.viewWasTapped(self.gestureRecognizerA)
With an obvious change to the method itself:
func viewWasTapped(_ sender: UIGestureRecognizer) {
// ...
}
This works for UITapGestureRecognizer
. The sender can be any other UIGestureRecognizer
and you'd still have almost all the information to resolve a tap gesture there.