My content view controller's primary view is a UIScrollView subclass, specifically: UITableVIew. Any advice on what the _correct_ solution is for getting the popupInteractionGestureRecognizer to work simultaneously with its installed panGestureRecognizer so that if the scroll view's contentOffset is zero, dragging down will dismiss the content view controller?
I have a crude initial attempt, which looks in the tableView's gesture recognizer array for popupInteractionGestureRecognizer. When the contentOffset is _just right (TM)_, it will stop the panGestureRecognizer from beginning.
It works...but not great.
private override func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {
// Capture '_popupGesture', if necessary...
if (gestureRecognizers?.contains(gestureRecognizer) ?? false) == false
&& gestureRecognizer is UIPanGestureRecognizer
&& _popupGesture == nil {
_popupGesture = gestureRecognizer as? UIPanGestureRecognizer
} else if gestureRecognizer == panGestureRecognizer {
if let _ = _popupGesture {
switch (contentOffset.y + 44.0, panGestureRecognizer.velocityInView(self).y) {
case (-CGFloat.max...0, 1...CGFloat.max):
return false
default:
return true
}
}
}
return true
}
Are you looking for an interactive dismiss (pulling the tableview moves the popup), or complete popup once a certain threshold is met?
Interactive dismiss: if the user has hit the top of the list, the popup controller dismisses.
I'm assuming this would require having the installed tableView.panGestureRecognizer fail to the popupInteractionGestureRecognizer, or vice versa?
Is there any progress on making this work?
Sorry, I have not had time to take a look at a solution for this issue.
Sorry to bump this again. Is there any new progress on this?
My solution to the problem is bit flaky at best.
I have not had time to tackle this. Feel free to submit pull requests.
@KevinVitale @joshluongo
Implemented! Pull your scrollview based views (inc. tables views and collection views) to dismiss. Note, that you must have the content controller's view be a scrollview based, so use UITableViewController, UICollectionViewController, etc.
What if you have a UIViewController with a scroll view inside for a custom layout?
@MaxHasADHD Please explain what you mean in more detail. If you have a complex question, feel free to open a new issue.
The controller I have to pop up is a UIViewController but has a UIScrollView as it's main content view with a custom layout, so I can't use UITableViewController or UICollectionViewController. How can I make the view controller drag down like in the demo with the scroll view?

Right now it is only supported if the controller's view is a subclass of scroll view. I may need expand that somehow, but it's not an easy task.
Open a new issue so we can track this.
@LeoNatan How does it currently work for the UITableView/UICollectionViewContoller's? Is it possible to reference the gesture and add it to my scroll view the same way it is added to those controllers?
@MaxHasADHD Ha! It's already supported out of the box. I checked my implementation. Just provide your scrollview as viewForPopupInteractionGestureRecognizer. Check the documentation and headers for more information.
@LeoNatan Seems not to be working correctly. Breakpoint is being hit but doesn't scroll.
@MaxHasADHD Found and fixed the issue. Please try now.
It works! Thank you