diff --git a/Source/DeckPresentationController.swift b/Source/DeckPresentationController.swift index 4d72e2f..f0bc940 100644 --- a/Source/DeckPresentationController.swift +++ b/Source/DeckPresentationController.swift @@ -561,6 +561,10 @@ final class DeckPresentationController: UIPresentationController, UIGestureRecog return } + if let deckViewController = presentedViewController as? DeckTransitionViewControllerProtocol { + guard deckViewController.shouldTransition!(for: ScrollViewDetector(withViewController: presentedViewController).scrollView) else { return } + } + switch gestureRecognizer.state { case .began: diff --git a/Source/DeckTransitionViewControllerProtocol.swift b/Source/DeckTransitionViewControllerProtocol.swift index edd0f9e..dbedb37 100644 --- a/Source/DeckTransitionViewControllerProtocol.swift +++ b/Source/DeckTransitionViewControllerProtocol.swift @@ -57,5 +57,11 @@ import UIKit /// `childViewControllerForDeck` variable is also implemented. @objc optional var scrollViewForDeck: UIScrollView { get } + /// Calls a delegate method to determine whether or not a Deck transition + /// should take place. + + /// - Note: Default for this method always returns `true` + @objc optional func shouldTransition(for scrollView: UIScrollView?) -> Bool + }