Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to choose inset and visiablity for scroll view #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions PanModal/Controller/PanModalPresentationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,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`
Expand Down Expand Up @@ -771,7 +771,7 @@ private extension PanModalPresentationController {
*/
func trackScrolling(_ scrollView: UIScrollView) {
scrollViewYOffset = max(scrollView.contentOffset.y, 0)
scrollView.showsVerticalScrollIndicator = true
scrollView.showsVerticalScrollIndicator = presentable?.shouldShowScrollIndicator ?? true
}

/**
Expand Down
8 changes: 8 additions & 0 deletions PanModal/Presentable/PanModalPresentable+Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,13 @@ public extension PanModalPresentable where Self: UIViewController {
func panModalDidDismiss() {

}

var shouldShowScrollIndicator: Bool {
return true
}

var bottomScrollInset: CGFloat? {
return nil
}
}
#endif
14 changes: 14 additions & 0 deletions PanModal/Presentable/PanModalPresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,19 @@ 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 true.
Copy link

@AivarasGus AivarasGus Nov 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this shouldn't be true. bottomLayoutGuide.length is probably what it should be

Suggested change
Default value is true.
Default value is bottomLayoutGuide.length.

*/
var bottomScrollInset: CGFloat? { get }
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,4 @@ class UserGroupViewController: UITableViewController, PanModalPresentable {
isShortFormEnabled = false
panModalSetNeedsLayoutUpdate()
}

}