I have a MKMapView
. I added a UITapGestureRecognizer
with a single tap.
I now want to add a MKAnnotationView
to the map. I can
It'd be much easier if we just test the superviews of the touch.view
in the gesture delegate:
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
var tv = touch.view
while let view = tv, !(view is MKAnnotationView) {
tv = view.superview
}
return tv == nil
}