MultiPageController 0.2.2

MultiPageController 0.2.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Nov 2016
SPMSupports SPM

Maintained by Rafael Martins.



  • By
  • Rafael Martins

MultiPageController

Component inspired by UIPageController that allows fast navigation by scrolling to switch to a different ViewController. ViewControllers are lazily instantiated the first time it gets activated.

An item gets automatically selected if the user stop scrolling, or the user can tap an element o select it.

MultiPageViewController Image

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS >= 9.0
  • Swift 3.0

Installation

MultiPageController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MultiPageController"

Usage

Set the MultipageController’s datasource and reload it’s data:

let multipageController = MultipageController()
multipageController.dataSource = self
multipageController.reloadData()

MultiPageControllerDataSource Methods

/*
* Returns the number of items to be presented when scrolling
*/
func numberOfItems(in: MultiPageController) -> Int

/*
* Returns a view to be used as preview of the item the user can select. 
* This is called only once per element.
*/
func multiPageController(_ multiPageController: MultiPageController, viewControllerAt index: Int) -> UIViewController

/* 
* Returns the view controller to be presented when the user taps selects an element. 
* This is called once the user first selects the element at the specified index
*/
func multiPageController(_ multiPageController: MultiPageController, previewViewAt index: Int) -> UIView

Author

Rafael Martins, [email protected]

License

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