CocoaPods trunk is moving to be read-only. Read more on the blog, there are 3 months to go.

OnboardFlow 0.1.7

OnboardFlow 0.1.7

Maintained by Maxime Cattet.



  • By
  • johnoppenheimer

OnboardFlow

CI Status Version License Platform

Example

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

Requirements

Installation

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

pod 'OnboardFlow'

How to use

Create the onboarding controller

Don't forget to import OnboardFlow, then you can just

let onboardingController = OnboardFlowViewController()
// Use the previously created ViewController
onboardingController.controllers = [ViewController()]

If you want to display dots at the bottom of the onboardingController:

onboardingController.showPageControl = true // default is false

By default the OnboardFlowViewController doesn't allow swipe to navigate between pages, but if you want to:

onboardingController.enableSwipe = true // default is false

The OnboardFlowViewController also possesses a onboardingDelegate that useful to know when onboarding should end:

onboardingController.onboardingDelegate = self

Then you can create an extension on you main controller:

extension MainViewController: OnboardFlowViewControllerDelegate {
    func finishOnboarding() {
        /**
        This will be called once the last controller call `done`
         */
    }
}

And that's it, you can then display that controller however you want.

Create controller for onboarding step

Each page in the OnboardFlowViewController must be an UIViewController to which you added the OnboardFlowCompletableController protocol and the delegate required.

import UIKit
import OnboardFlow

class ViewController: UIViewController, OnboardFlowCompletableController {
    var completableDelegate: OnboardFlowCompletableControllerDelegate?

    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

If you didn't allow swipe, to let the OnboardFlowViewController know that you are done with that controller, call the delegate done method so that the OnboardFlowViewController continue:

self.completableDelegate?.done(controller: self)

Finishing the onboarding flow

Once you reach the end of your flow, make that controller call its OnboardFlowCompletableControllerDelegate done method.

Author

johnoppenheimer, [email protected]

License

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