How to make UIPanGestureRecognizer work with horizontal swipe in UICollectionView

Issue #315

extension PanCollectionViewController: UIGestureRecognizerDelegate {
    func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        let velocity = panGR.velocity(in: panGR.view)
        return abs(velocity.y) > abs(velocity.x)
    }
}
Written by

I’m open source contributor, writer, speaker and product maker.

Start the conversation