Skip to content

Commit

Permalink
Add normalizesInfiniteScrollPositions
Browse files Browse the repository at this point in the history
  • Loading branch information
msaps committed Apr 6, 2024
1 parent ec420b3 commit 154c190
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ internal extension PageboyViewController {
/// - Parameter pagePosition: the current page position.
/// - Returns: The updated page position (if needed).
func adjustedPagePositionForInfiniteOverscroll(from pagePosition: CGFloat) -> CGFloat? {
guard isInfinitelyScrolling(forPosition: pagePosition) else {
guard normalizesInfiniteScrollPositions && isInfinitelyScrolling(forPosition: pagePosition) else {
return nil
}

Expand Down
5 changes: 5 additions & 0 deletions Sources/Pageboy/PageboyViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ open class PageboyViewController: UIViewController {
reloadCurrentPageSoftly()
}
}
/// Whether to normalize positions that exceed the page bounds that are encountered when infinitely scrolling
/// between page boundaries.
///
/// Default is `true`.
open var normalizesInfiniteScrollPositions: Bool = true
/// Whether the page view controller is currently animating a scroll between pages.
private(set) internal var isScrollingAnimated = false {
didSet {
Expand Down

0 comments on commit 154c190

Please sign in to comment.