Swift 4
Conform the view controller to the UIGestureRecognizerDelegate
...
SomeViewController: UIViewController, UIGestureRecognizerDelegate {
...
}
...set the view controller as the custom pan gesture recognizer's delegate...
customPanGestureRecognizer.delegate = self
...and using the simultaneous delegate, allow the custom panner and the scroll view's (or table view's) panner to operate simultaneously...
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
if otherGestureRecognizer == scrollView.panGestureRecognizer { // or tableView.panGestureRecognizer
return true
} else {
return false
}
}
There are two other methods that ask the delegate if a gesture recognizer should require another gesture recognizer to fail or if a gesture recognizer should be required to fail by another gesture recognizer. You will likely need further optimization beyond this but this is the starting point.