diff --git a/Pageboy.podspec b/Pageboy.podspec index 378cef08..a623ba8e 100644 --- a/Pageboy.podspec +++ b/Pageboy.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.platform = :ios, "9.0" s.requires_arc = true - s.version = "0.4.6" + s.version = "0.4.7" s.summary = "A simple, highly informative page view controller." s.description = <<-DESC Pageboy is a page view controller that provides simplified data source management, enhanced delegation and other useful features. diff --git a/Sources/Pageboy/Info.plist b/Sources/Pageboy/Info.plist index e3726473..d1453129 100644 --- a/Sources/Pageboy/Info.plist +++ b/Sources/Pageboy/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.4.6 + 0.4.7 CFBundleVersion AUTO_GENERATED NSPrincipalClass diff --git a/Sources/Pageboy/PageboyScrollDetection.swift b/Sources/Pageboy/PageboyScrollDetection.swift index 1a0d92c2..b10e0b38 100644 --- a/Sources/Pageboy/PageboyScrollDetection.swift +++ b/Sources/Pageboy/PageboyScrollDetection.swift @@ -69,7 +69,7 @@ extension PageboyViewController: UIPageViewControllerDelegate, UIScrollViewDeleg contentOffset = scrollView.contentOffset.y } - let scrollIndexDiff = CGFloat(abs((self.expectedTransitionIndex ?? currentIndex + 1) - currentIndex)) + let scrollIndexDiff = CGFloat(max(1, abs((self.expectedTransitionIndex ?? currentIndex + 1) - currentIndex))) let scrollOffset = contentOffset - pageSize let pageOffset = (CGFloat(currentIndex) * pageSize) + (scrollOffset * scrollIndexDiff) var pagePosition = pageOffset / pageSize @@ -96,7 +96,7 @@ extension PageboyViewController: UIPageViewControllerDelegate, UIScrollViewDeleg } else { positionPoint = CGPoint(x: scrollView.contentOffset.x, y: pagePosition) } - + // ignore duplicate updates guard self.currentPosition != positionPoint else { return } self.currentPosition = positionPoint