Latest 0.1.3
Homepage https://github.com/hborjaille/SimpleWizzard
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

alt text

Requirements

iOS 9+

Installation

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

pod "SimpleWizzard"

Example

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

Code Examples

Creating a ViewController that will be encapsulated on SimpleWizzard

This controller needs to implement ChangeStepDelegate that will tell the Wizzard when to change the Step or not.

import SimpleWizzard

class SampleStepViewController: UIViewController, ChangeStepDelegate {

    func verifyNext() -> Bool {
        SampleWizardController.wizardInstance?.next()
        return false
    }

    func verifyPrev() -> Bool {
        return true
    }
}
There are two ways to use it

Return false into veryfyNext() function and force the changing

func verifyNext() -> Bool {
    SampleWizardController.wizardInstance?.next()
    return false
}

Or simply returning true on the function

func verifyNext() -> Bool {
    return true
}

The same applies for changing from current to previous ViewController.

Creating a ViewController extending from SimpleWizzardViewController

The created class has to implement CancelDelegate. This class will be responsible for canceling the wizzard progress. The user needs to instantiate every ViewController that it wants to use, before use the function generate.

import SimpleWizzard

class SampleWizardController: SimpleWizardViewController, CancelDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Setting the Delegate Cancel
        self.cancelDelegate = self

        // Creating the steps
        var viewControllerList = [UIViewController]()

        let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
        for i in 0...5 {
            if let controller = mainStoryboard.instantiateViewController(withIdentifier: "sampleStepSID") as? SampleStepViewController {
                controller.pageNumberText = i.description
                viewControllerList.append(controller)
            }
        }

        // Setting the images
        self.nextImage = UIImage(named: "right")
        self.prevImage = UIImage(named: "left")
        self.doneImage = UIImage(named: "done_wizzard")

        // Setting the color of UIPageDots
        self.pageDots?.currentPageIndicatorTintColor = UIColor.black
        self.pageDots?.pageIndicatorTintColor = UIColor.lightGray

        // Generating the SimpleWizard
        self.generate(viewControllerList)

        // Setting Title
        self.title = "SimpleWizzard"
    }

    func cancel() {
        self.dismiss(animated: true, completion: nil)
    }
}

Author

Higor Borjaille

E-mail: [email protected]

License

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

Latest podspec

{
    "name": "SimpleWizzard",
    "version": "0.1.3",
    "summary": "A library that helps the user to build a Stepper for its form or anything it wants.",
    "description": "A library that helps the user to build a Stepper for its form or anything it wants. Giving it the power to change anything it wants.",
    "homepage": "https://github.com/hborjaille/SimpleWizzard",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "hborjaille": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hborjaille/SimpleWizzard.git",
        "tag": "0.1.3"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "SimpleWizzard/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This