Skip to content

Commit

Permalink
Merge pull request #130 from uias/feature/disable-page-control
Browse files Browse the repository at this point in the history
Feature/disable page control
  • Loading branch information
msaps authored Dec 20, 2017
2 parents a5f6b89 + b1e830c commit 12a0403
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,24 @@ extension PageboyViewController: UIPageViewControllerDelegate, UIScrollViewDeleg
self.updateCurrentPageIndexIfNeeded(index)
}
}

public func presentationCount(for pageViewController: UIPageViewController) -> Int {
guard showsPageControl else {
return -1
}
return pageCount ?? 0
}

public func presentationIndex(for pageViewController: UIPageViewController) -> Int {
guard showsPageControl else {
return -1
}
return targetIndex ?? 0
}

// TODO - Enable this when issue in iOS 11.2 is resolved.
//
// See here: https://github.com/uias/Pageboy/issues/128
//
// public func presentationCount(for pageViewController: UIPageViewController) -> Int {
// guard showsPageControl else {
// return -1
// }
// return pageCount ?? 0
// }
//
// public func presentationIndex(for pageViewController: UIPageViewController) -> Int {
// guard showsPageControl else {
// return -1
// }
// return targetIndex ?? 0
// }

// MARK: UIScrollViewDelegate

Expand Down
1 change: 1 addition & 0 deletions Sources/Pageboy/PageboyViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ open class PageboyViewController: UIViewController {
public let autoScroller = PageboyAutoScroller()

/// Whether to show the built-in UIPageViewController page control.
@available(*, deprecated: 1.2.0, message: "Temporarily unavailable due to iOS 11.2 UIPageViewController issue. See here: https://github.com/uias/Pageboy/issues/128")
public var showsPageControl: Bool = false

// MARK: Lifecycle
Expand Down

0 comments on commit 12a0403

Please sign in to comment.