diff --git a/PanModal/Controller/PanModalPresentationController.swift b/PanModal/Controller/PanModalPresentationController.swift index 3739c19..1df3663 100644 --- a/PanModal/Controller/PanModalPresentationController.swift +++ b/PanModal/Controller/PanModalPresentationController.swift @@ -550,7 +550,7 @@ private extension PanModalPresentationController { Allow api consumers to override the internal conditions & decide if the pan gesture recognizer should be prioritized. - ⚠️ This is the only time we should be cancelling a recognizer, + ⚠️ This is the only time we should be cancelling the panScrollable recognizer, for the purpose of ensuring we're no longer tracking the scrollView */ guard !shouldPrioritize(panGestureRecognizer: panGestureRecognizer) else { @@ -577,7 +577,7 @@ private extension PanModalPresentationController { */ func shouldPrioritize(panGestureRecognizer: UIPanGestureRecognizer) -> Bool { return panGestureRecognizer.state == .began && - presentable?.shouldPrioritize(panModalGestureRecognizer: panGestureRecognizer) ?? false + presentable?.shouldPrioritize(panModalGestureRecognizer: panGestureRecognizer) == true } /** diff --git a/PanModal/Presentable/PanModalHeight.swift b/PanModal/Presentable/PanModalHeight.swift index fae6dd6..547e633 100644 --- a/PanModal/Presentable/PanModalHeight.swift +++ b/PanModal/Presentable/PanModalHeight.swift @@ -1,6 +1,6 @@ // // PanModalHeight.swift -// SlackUI +// PanModal // // Copyright © 2019 Tiny Speck, Inc. All rights reserved. // diff --git a/PanModal/Presentable/PanModalPresentable+Defaults.swift b/PanModal/Presentable/PanModalPresentable+Defaults.swift index eefd60f..a956596 100644 --- a/PanModal/Presentable/PanModalPresentable+Defaults.swift +++ b/PanModal/Presentable/PanModalPresentable+Defaults.swift @@ -2,7 +2,6 @@ // PanModalPresentable+Defaults.swift // PanModal // -// Created by Stephen Sowole on 11/5/18. // Copyright © 2018 Tiny Speck, Inc. All rights reserved. // @@ -31,6 +30,10 @@ public extension PanModalPresentable where Self: UIViewController { return .contentHeight(scrollView.contentSize.height) } + var cornerRadius: CGFloat { + return 8.0 + } + var springDamping: CGFloat { return 0.8 } @@ -77,10 +80,6 @@ public extension PanModalPresentable where Self: UIViewController { return isPanModalPresented } - var cornerRadius: CGFloat { - return 8.0 - } - var showDragIndicator: Bool { return shouldRoundTopCorners } diff --git a/PanModal/Presentable/PanModalPresentable.swift b/PanModal/Presentable/PanModalPresentable.swift index 60b6026..5885a44 100644 --- a/PanModal/Presentable/PanModalPresentable.swift +++ b/PanModal/Presentable/PanModalPresentable.swift @@ -13,7 +13,7 @@ import UIKit Usage: ``` - extension UIViewController: PanModalPresentable { + extension YourViewController: PanModalPresentable { func shouldRoundTopCorners: Bool { return false } } ``` @@ -54,6 +54,13 @@ public protocol PanModalPresentable { */ var longFormHeight: PanModalHeight { get } + /** + The corner radius used when `shouldRoundTopCorners` is enabled. + + Default Value is 8.0. + */ + var cornerRadius: CGFloat { get } + /** The springDamping value used to determine the amount of 'bounce' seen when transitioning to short/long form. @@ -91,13 +98,13 @@ public protocol PanModalPresentable { A flag to determine if scrolling should seamlessly transition from the pan modal container view to the embedded scroll view once the scroll limit has been reached. - Default value is false. - Unless a scrollView is provided and the content exceeds the longForm height + Default value is false. Unless a scrollView is provided and the content height exceeds the longForm height. */ var allowsExtendedPanScrolling: Bool { get } /** A flag to determine if dismissal should be initiated when swiping down on the presented view. + Return false to fallback to the short form state instead of dismissing. Default value is true. @@ -137,13 +144,6 @@ public protocol PanModalPresentable { */ var shouldRoundTopCorners: Bool { get } - /** - The corner radius used when `shouldRoundTopCorners` is enabled. - - Default Value is 8.0. - */ - var cornerRadius: CGFloat { get } - /** A flag to determine if a drag indicator should be shown above the pan modal container view. @@ -161,7 +161,7 @@ public protocol PanModalPresentable { Default value is an empty implementation. */ - func willRespond(to panGestureRecognizer: UIPanGestureRecognizer) + func willRespond(to panModalGestureRecognizer: UIPanGestureRecognizer) /** Asks the delegate if the pan modal gesture recognizer should be prioritized. @@ -169,8 +169,8 @@ public protocol PanModalPresentable { For example, you can use this to define a region where you would like to restrict where the pan gesture can start. - If false, then we rely on the internal conditions of when a pan gesture - should succeed or fail, such as, if we're actively scrolling on the scrollView + If false, then we rely solely on the internal conditions of when a pan gesture + should succeed or fail, such as, if we're actively scrolling on the scrollView. Default return value is false. */ diff --git a/PanModal/Presenter/PanModalPresenter.swift b/PanModal/Presenter/PanModalPresenter.swift index 3d8c336..61e3215 100644 --- a/PanModal/Presenter/PanModalPresenter.swift +++ b/PanModal/Presenter/PanModalPresenter.swift @@ -1,6 +1,6 @@ // // PanModalPresenter.swift -// SlackUI +// PanModal // // Copyright © 2019 Tiny Speck, Inc. All rights reserved. // diff --git a/PanModal/Presenter/UIViewController+PanModalPresenter.swift b/PanModal/Presenter/UIViewController+PanModalPresenter.swift index a7716d1..f663c50 100644 --- a/PanModal/Presenter/UIViewController+PanModalPresenter.swift +++ b/PanModal/Presenter/UIViewController+PanModalPresenter.swift @@ -1,6 +1,6 @@ // // UIViewController+PanModalPresenterProtocol.swift -// SlackUI +// PanModal // // Copyright © 2019 Tiny Speck, Inc. All rights reserved. //