swift allow gesture recognizer over others code example
Example 1: swift allow gesture recognizer over others
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,
shouldRequireFailureOf otherGestureRecognizer: UIGestureRecognizer) -> Bool {
// Don't recognize a single tap until a double-tap fails.
if gestureRecognizer == self.tapGesture &&
otherGestureRecognizer == self.doubleTapGesture {
return true
}
return false
}
Example 2: swift allow gesture recognizer over others
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,
shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
// Do not begin the pan until the swipe fails.
if gestureRecognizer == self.swipeGesture &&
otherGestureRecognizer == self.panGesture {
return true
}
return false
}