Ok so I have been looking around at just about every option under the sun for capturing multi-touch gestures, and I have finally come full circle and am back at the UIPanGesture
Here's an easy to detect before the gesture recognizer begins:
public override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
guard let panRecognizer = gestureRecognizer as? UIPanGestureRecognizer else {
return super.gestureRecognizerShouldBegin(gestureRecognizer)
}
// Ensure it's a horizontal drag
let velocity = panRecognizer.velocity(in: self)
if abs(velocity.y) > abs(velocity.x) {
return false
}
return true
}
If you want a vertical only drag, you can switch the x
and y
.