Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save RaajeevChandran/e0fa4fcfec02e9b5f513061125358696 to your computer and use it in GitHub Desktop.

Select an option

Save RaajeevChandran/e0fa4fcfec02e9b5f513061125358696 to your computer and use it in GitHub Desktop.
extension BottomSheetPresentationController {
private func setupInteraction() {
guard let presentedView = presentedView else {
return
}
func addGestureIfNeeded(_ gesture: UIGestureRecognizer, to view: UIView, delegate: UIGestureRecognizerDelegate? = nil) {
if let recognizers = view.gestureRecognizers, recognizers.contains(gesture) {
return
}
gesture.delegate = delegate
view.addGestureRecognizer(gesture)
}
addGestureIfNeeded(panGesture, to: presentedView, delegate: self)
addGestureIfNeeded(tapGestureToDismiss, to: dimmedBackgroundView)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment