Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions PanModal/Controller/PanModalPresentationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,14 @@ private extension PanModalPresentationController {

extension PanModalPresentationController: UIGestureRecognizerDelegate {

/**
Asks the delegate if the pan modal should begin to track the pan gesture
*/
public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
guard gestureRecognizer == panGestureRecognizer else { return true }
return presentable?.shouldBeginPanGesture(panGestureRecognizer) ?? true
}

/**
Do not require any other gesture recognizers to fail
*/
Expand Down
4 changes: 4 additions & 0 deletions PanModal/Presentable/PanModalPresentable+Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public extension PanModalPresentable where Self: UIViewController {
var showDragIndicator: Bool {
return shouldRoundTopCorners
}

func shouldBeginPanGesture(_ panModalGestureRecognizer: UIPanGestureRecognizer) -> Bool {
return true
}

func shouldRespond(to panModalGestureRecognizer: UIPanGestureRecognizer) -> Bool {
return true
Expand Down
9 changes: 9 additions & 0 deletions PanModal/Presentable/PanModalPresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ public protocol PanModalPresentable: AnyObject {
*/
var showDragIndicator: Bool { get }

/**
Asks the delegate if the pan modal should begin to track the pan gesture.

Return false to not track the pan gesture and possibly let other observers track the gesture

Default value is true.
*/
func shouldBeginPanGesture(_ panModalGestureRecognizer: UIPanGestureRecognizer) -> Bool

/**
Asks the delegate if the pan modal should respond to the pan modal gesture recognizer.

Expand Down