I just have an UICollectionView inside my UIViewController.
I am using SWRevealViewController to open left/right side menu. I can set its panGestureRecognizer to provide full screen panning.
view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
The following method will provide a panGestureRecognizer suitable to be added to any view in order to perform usual drag and swipe gestures to reveal the rear views. This is usually added to the top bar of a front controller, but it can be added to your frontViewController view or to the reveal controller view to provide full screen panning. By default, the panGestureRecognizer is added to the view containing the front controller view. To keep this default behavior you still need to call this method, just don't add it to any of your views. The default setup allows you to dissable user interactions on your controller views without affecting the recognizer.
My issue is that on a specific cell of my UICollectionView I don't have any spacing on the edges. The cellWidth = collectionView.bounds.size.width
AND this cell contains an UICollectionView with horizontal scrolling.
Instead of opening my left/right menu, it just scroll horizontally my UICollectionView.
I would like to handle this scenario:
1: if the panGesture is located within the UICollectionViewCell containing the UICollectionView with horizontal scrolling.
2: detect the gesture location on the horizontal axis, and if it is on the edge of the screen, don't trigger the horizontal scrolling of the UICollectionView but trigger the panGesture to open the menu.
After reading a lot of articles and the official documentation I found this UIScreenEdgePanGestureRecognizer.
But also that this logic should be done by overriding the method shouldReceiveTouch, am I right?
Any hint on how I should implement this ?
EDIT:
After reading the question suggested in the comment, this is what I tried, but it's not working.
let edgePanGesture = UIScreenEdgePanGestureRecognizer()
collectionView.panGestureRecognizer.require(toFail: edgePanGesture)
I set this in my cell containing the horizontal collectionView but it's not working.
I might be missing something, any help?