Skip to content

Commit

Permalink
Oops
Browse files Browse the repository at this point in the history
  • Loading branch information
robertofrontado committed Nov 9, 2018
1 parent e4ba717 commit 97becca
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Library/OkPagerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ open class OkPagerView: UIView, UIPageViewControllerDataSource, UIPageViewContro
}

// Create a new View Controller and pass suitable data.
guard let viewController = dataSource.viewControllerAtIndex(index) else {
guard let viewController = dataSource?.viewControllerAtIndex(index) else {
return nil
}

Expand Down Expand Up @@ -190,10 +190,8 @@ open class OkPagerView: UIView, UIPageViewControllerDataSource, UIPageViewContro
// MARK: - UIPageViewControllerDelegate
open func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
if completed {
if let pageVC = pageViewController.viewControllers?.last as? UIViewController {
if let delegate = delegate {
delegate.onPageSelected(pageVC, index: pageVC.view.tag)
}
if let pageVC = pageViewController.viewControllers?.last {
delegate?.onPageSelected(pageVC, index: pageVC.view.tag)
// Save currentIndex
currentIndex = pageVC.view.tag
pageControl?.currentPage = currentIndex
Expand Down

0 comments on commit 97becca

Please sign in to comment.