UXPasscodeField 1.2.1

UXPasscodeField 1.2.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Eddie Lau.



  • By
  • Eddie Lau

UXPasscodeField

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.