From 6adc81584f8a5d78a81965cba523993407dab214 Mon Sep 17 00:00:00 2001 From: Leonty Deriglazov Date: Mon, 10 Jun 2019 16:26:18 -0400 Subject: [PATCH] fix(paging): Fix paging formulas --- FueledUtils/ScrollViewPage.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FueledUtils/ScrollViewPage.swift b/FueledUtils/ScrollViewPage.swift index f42daf41..a32ca4aa 100644 --- a/FueledUtils/ScrollViewPage.swift +++ b/FueledUtils/ScrollViewPage.swift @@ -55,7 +55,7 @@ extension UIScrollView { /// public var currentPage: Int { get { - let page = Int((self.bounds.size.width / self.contentOffset.x).rounded()) + let page = Int((self.contentOffset.x / self.bounds.size.width).rounded()) return min(max(0, page), self.numberOfPages - 1) } set { @@ -69,7 +69,7 @@ extension UIScrollView { /// - Returns: Returns the number of pages. /// public var numberOfPages: Int { - return Int((self.bounds.size.width / self.contentSize.width).rounded(.up)) + return Int((self.contentSize.width / self.bounds.size.width).rounded(.up)) } ///