             infinitePagePosition = maxInfinitePosition
         }
         
-        pagePosition = infinitePagePosition
+        return infinitePagePosition
     }
     
     /// Whether a position is infinitely scrolling between end ranges

    }
    
    /// Detect whether the scroll view is overscrolling while infinite scroll is enabled
    /// Adjusts pagePosition if required.
    ///
    /// - Parameter pagePosition: the relative page position.
    private func detectInfiniteOverscrollIfNeeded(pagePosition: inout CGFloat) {
        guard self.isInfinitelyScrolling(forPosition: pagePosition) else {
            return
        }
        
        let maxPagePosition = CGFloat((self.viewControllerCount ?? 1) - 1)

extension PageboyViewController: UIScrollViewDelegate {
    
    public func scrollViewDidScroll(_ scrollView: UIScrollView) {
        guard let currentIndex = self.currentIndex, scrollViewIsActual(scrollView) else {
            return
        }
        guard updateContentOffsetForBounceIfNeeded(scrollView: scrollView) == false else {
            return
        }
        
        guard let (newPosition, previousPosition) = calculateNewPagePosition(in: scrollView, currentIndex: currentIndex) else {
            return
        }
        // do not continue if a page change is detected
        let didDetectNewPage = detectNewPageIndexIfNeeded(pagePosition: newPosition,
                                                          scrollView: scrollView)
        guard !didDetectNewPage else {
            return
        }
        
        // update page position for infinite overscroll if required
        let pagePosition: CGFloat
        if let infiniteAdjustedPosition = adjustedPagePositionForInfiniteOverscroll(from: newPosition) {
            pagePosition = infiniteAdjustedPosition
        } else {
            pagePosition = newPosition
        }
        
        // provide scroll updates
        var positionPoint: CGPoint!
        let direction = NavigationDirection.forPosition(pagePosition, previous: previousPosition)
        if self.navigationOrientation == .horizontal {
            positionPoint = CGPoint(x: pagePosition, y: scrollView.contentOffset.y)
        } else {
