Skip to content

Commit

Permalink
Merge pull request #39 from Fueled/paging-fixes
Browse files Browse the repository at this point in the history
fix(paging): Fix paging formulas
  • Loading branch information
Leon Deriglazov authored Jun 10, 2019
2 parents 6e4a93b + 6adc815 commit 1af4b0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions FueledUtils/ScrollViewPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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))
}

///
Expand Down

0 comments on commit 1af4b0b

Please sign in to comment.