                 return
         }
         
-        self.expectedTransitionIndex = index
-        let direction = NavigationDirection.forPage(index, previousPage: self.currentIndex ?? index)
-        self.delegate?.pageboyViewController(self, willScrollToPageAt: index,
-                                             direction: direction,
-                                             animated: animated)
+        expectedTransitionIndex = index
+        let direction = NavigationDirection.forPage(index, previousPage: currentIndex ?? index)
+        delegate?.pageboyViewController(self, willScrollToPageAt: index,
+                                        direction: direction,
+                                        animated: animated)
     }
     
     public func pageViewController(_ pageViewController: UIPageViewController,

    /// - Parameter scrollView: The scroll view.
    /// - Returns: Whether the contentOffset was manipulated to achieve bouncing preference.
    @discardableResult private func updateContentOffsetForBounceIfNeeded(scrollView: UIScrollView) -> Bool {
        guard self.bounces == false else {
            return false
        }
        
        let previousContentOffset = scrollView.contentOffset
        if self.currentIndex == 0 && scrollView.contentOffset.x < scrollView.bounds.size.width {
            scrollView.contentOffset = CGPoint(x: scrollView.bounds.size.width, y: 0.0)
        }
        if self.currentIndex == (self.viewControllerCount ?? 1) - 1 && scrollView.contentOffset.x > scrollView.bounds.size.width {
            scrollView.contentOffset = CGPoint(x: scrollView.bounds.size.width, y: 0.0)
        }
        return previousContentOffset != scrollView.contentOffset

        
        if let viewController = pageViewController.viewControllers?.first,
            let index = viewControllerMap.index(forObjectAfter: { return $0.object === viewController }) {
            guard index == expectedTransitionIndex else {
                return
            }
            
            updateCurrentPageIndexIfNeeded(index)
        }
    }

