diff --git a/PanModal/Controller/PanModalPresentationController.swift b/PanModal/Controller/PanModalPresentationController.swift index 11fb2a6e..89fc83df 100644 --- a/PanModal/Controller/PanModalPresentationController.swift +++ b/PanModal/Controller/PanModalPresentationController.swift @@ -454,7 +454,7 @@ private extension PanModalPresentationController { Set the appropriate contentInset as the configuration within this class offsets it */ - scrollView.contentInset.bottom = presentingViewController.bottomLayoutGuide.length + scrollView.contentInset.bottom = presentable?.bottomScrollInset ?? presentingViewController.bottomLayoutGuide.length /** As we adjust the bounds during `handleScrollViewTopBounce` @@ -769,7 +769,7 @@ private extension PanModalPresentationController { */ func trackScrolling(_ scrollView: UIScrollView) { scrollViewYOffset = max(scrollView.contentOffset.y, 0) - scrollView.showsVerticalScrollIndicator = true + scrollView.showsVerticalScrollIndicator = presentable?.shouldShowScrollIndicator ?? true } /** diff --git a/PanModal/Presentable/PanModalPresentable+Defaults.swift b/PanModal/Presentable/PanModalPresentable+Defaults.swift index 76a0679f..9d567dc1 100644 --- a/PanModal/Presentable/PanModalPresentable+Defaults.swift +++ b/PanModal/Presentable/PanModalPresentable+Defaults.swift @@ -124,5 +124,13 @@ public extension PanModalPresentable where Self: UIViewController { func panModalDidDismiss() { } + + var shouldShowScrollIndicator: Bool { + return true + } + + var bottomScrollInset: CGFloat? { + return nil + } } #endif diff --git a/PanModal/Presentable/PanModalPresentable.swift b/PanModal/Presentable/PanModalPresentable.swift index 76c15015..513f4437 100644 --- a/PanModal/Presentable/PanModalPresentable.swift +++ b/PanModal/Presentable/PanModalPresentable.swift @@ -233,5 +233,17 @@ public protocol PanModalPresentable: AnyObject { Default value is an empty implementation. */ func panModalDidDismiss() + + /** + A flag to determine should we show scroll indicator in normal state for scroll view + Default value is true. + */ + var shouldShowScrollIndicator: Bool { get } + + /** + The inset for scroll view which will override default one (bottomLayoutGuide.height) + Default value is nil + */ + var bottomScrollInset: CGFloat? { get } } #endif diff --git a/Tests/PanModalTests.swift b/Tests/PanModalTests.swift index 7652b55f..89258a17 100644 --- a/Tests/PanModalTests.swift +++ b/Tests/PanModalTests.swift @@ -60,6 +60,8 @@ class PanModalTests: XCTestCase { XCTAssertEqual(vc.shouldRoundTopCorners, false) XCTAssertEqual(vc.showDragIndicator, false) XCTAssertEqual(vc.shouldRoundTopCorners, false) + XCTAssertEqual(vc.shouldShowScrollIndicator, true) + XCTAssertEqual(vc.bottomScrollInset, nil) XCTAssertEqual(vc.cornerRadius, 8.0) XCTAssertEqual(vc.transitionDuration, PanModalAnimator.Constants.defaultTransitionDuration) XCTAssertEqual(vc.transitionAnimationOptions, [.curveEaseInOut, .allowUserInteraction, .beginFromCurrentState])