79491760

Date: 2025-03-07 09:19:07
Score: 0.5
Natty:
Report link

The issue happens because touchesBegan is interfering with the scroll gesture on the first touch. Instead of recognizing the scroll, the collection view thinks it's just a touch.

Simple Fix:

  1. Remove these lines from touchesBegan and touchesEnded:

    self.next?.touchesBegan(touches, with: event) 
    self.next?.touchesEnded(touches, with: event)
    
    

    These lines forward touches manually, which disrupts scrolling.

  2. Override gestureRecognizerShouldBegin to ensure scrolling works:

    override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        return gestureRecognizer is UIPanGestureRecognizer
    }
    
    

    This makes sure scrolling is detected properly.

Why This Works?

After these changes, scrolling will work as expected on the first touch. 🚀

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Bala B iOS