Skip to content

eddy-lau/UXPasscodeField

Repository files navigation

UXPasscodeField

[![CI Status](http://img.shields.io/travis/Eddie Lau/UXPasscodeField.svg?style=flat)](https://travis-ci.org/Eddie Lau/UXPasscodeField) Version License Platform

Screenshot

Screenshot

Example Project

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

Sample Code

UXPasscodeField

import UIKit
import UXPasscodeField

class ViewController: UIViewController {

    @IBOutlet weak var passcodeField: UXPasscodeField!

    override func viewDidLoad() {
        super.viewDidLoad()

        passcodeField.becomeFirstResponder()

        // Optional, default is 6
        passcodeField.numberOfDigits = 6

        // Optional, default is false
        passcodeField.isSecureTextEntry = false

        passcodeField.addTarget(
          self,
          action: #selector(ViewController.passcodeFieldDidChangeValue),
          for: .valueChanged)

    }

    @IBAction func passcodeFieldDidChangeValue() {
        print(passcodeField.passcode)
    }

}

UXPasscodeViewController

  let passcodeViewController = UXPasscodeViewController.instantiate()
  passcodeViewController.message = "Hello iOS developer! Please input your 4-digit code here."
  passcodeViewController.numberOfDigits = 4
  passcodeViewController.done { passcode in

      print(passcode)
      _ = passcodeViewController.resignFirstResponder()

  }

Requirements

iOS 8 or above.

Installation

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

pod "UXPasscodeField"

Author

Eddie Lau, [email protected]

License

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published