Latest 0.1.0
Homepage https://github.com/kimjune01/JKPageViewController
License MIT
Platforms ios 8.1
Frameworks UIKit
Authors

The quickest way to use page view controllers with customization and callbacks. (Swift 1.2)

demo

Code


override func viewDidLoad() {
  super.viewDidLoad()
  pageViewController = JKPageViewController(transitionStyle: UIPageViewControllerTransitionStyle.Scroll, navigationOrientation: .Horizontal, options: nil)
  pageViewController.pages = [FirstOnboardingVC(), SecondOnboardingVC(), ThirdOnboardingVC()]

  addChildViewController(pageViewController)
  view.addSubview(pageViewController.view)
  pageViewController.didMoveToParentViewController(self)

  pageViewController.setInitialPage()
}

Pod

pod 'JKPageViewController'

Customize

To enable page indicators that show white dots at the bottom:

pageViewController.pageControlEnabled = true

To enable logging for looking under the hood:

pageViewController.debugging = true

To get callbacks for the child view controllers to be notified when it appears on screen:

extension MyPagedChildViewController: Appearable {
  func didAppearOnScreen() {
    // called when the view finishes decelerating onto the screen.
  }

  func didDisappearFromScreen(){
    // called when the view finishes decelerating off the screen.
  }

  func willAppearOnScreen(){
    // called when the view begins accelerating onto the screen.
  }

  func willDisappearFromScreen(){
    // called when the view begins accelerating off the screen.
  }
}

Areas for Improvements / involvement

  • Adding customization options.
  • Adding callbacks to the scroll position for the child view controller to be fully aware of its position in relation to scrollView.contentoffset for dynamic animations

Author

June Kim, [email protected]

License

JKPageViewController is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "JKPageViewController",
    "version": "0.1.0",
    "summary": "A simple wrapper class for UIPageViewController with easy implementation.",
    "description": " - encapsulates common delegate methodsnn- keeps track of indexesnn- turns page control on/off with the pageControlEnabled booleannn- comes with an Appearable hook for child view controllersn",
    "homepage": "https://github.com/kimjune01/JKPageViewController",
    "license": "MIT",
    "authors": {
        "June Kim": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kimjune01/JKPageViewController.git",
        "tag": "0.1.0"
    },
    "requires_arc": false,
    "platforms": {
        "ios": "8.1"
    },
    "source_files": "JKPageViewController.swift",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This