Latest 1.1.0
Homepage https://github.com/psartzetakis/JRPageViewControllerKit
License MIT
Platforms ios 8.0, requires ARC

Build Status
Version Status
Carthage compatible
Platform
license MIT

JRPageViewControllerKit wraps all the boilerplate code that is required for the implementation of UIPageViewController.

About

This library aims to wrap all the boilerplate code that is required for the implementation of the UIPageViewController. Within a few lines of code you have a UIPageViewController ready to run. In order to achieve that this library overrides the UIPageViewControllerDataSource and UIPageViewControllerDelegate with a custom implementation. It also implements the UIScrollViewDelegate of the scrollview that is within the UIPageViewController.

Requirements

  • iOS 8+
  • Swift 4.0
  • Xcode 9

Installation

CocoaPods

use_frameworks!

pod 'JRPageViewControllerKit'

Carthage

github "psartzetakis/JRPageViewControllerKit"

Getting Started

import JRPageViewControllerKit

Example


// 1. Create a factory that will return viewController for a specific index.
let factory: ((Int) -> ChildViewController?) = { [unowned self] index -> ChildViewController? in
    let viewController = self.storyboard!.instantiateViewController(withIdentifier: "ChildViewController") as! ChildViewController
    viewController.index = index
    return viewController
}

// 2. Instantiate a PageViewControllerManager.
let pageViewControllerManager = PageViewControllerManager(insertIn: containerView, inViewController: self, totalPages: 6, viewControllerForIndex: factory)

// 3. Get notified when user swiped to another viewController.
pageViewControllerManager.didScrollToIndex = { index in
    // The index that the user has just scrolled.
}

// 4. Get notified when another viewController is about to be appeared.
pageViewControllerManager.nextViewControllerAppears = { [unowned self] direction, ratio, destinationIndex in
    let ratio = String(format: "%.2f", ratio)
    let text = "direction:(direction.rawValue), ratio:(ratio),n  to (destinationIndex)"
}

Licence

JRPageViewControllerKit is being provided under MIT Licence.

Copyright © 2016-present Panagiotis Sartzetakis

Latest podspec

{
    "name": "JRPageViewControllerKit",
    "version": "1.1.0",
    "summary": "JRPageViewControllerKit wraps all the boilerplate code that is required for the implementation of `UIPageViewController`.",
    "homepage": "https://github.com/psartzetakis/JRPageViewControllerKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Panagiotis Sartzetakis",
    "source": {
        "git": "https://github.com/psartzetakis/JRPageViewControllerKit.git",
        "tag": "1.1.0"
    },
    "social_media_url": "https://twitter.com/SartzetakisP",
    "source_files": "Source/*.swift",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This