/SVPinView

SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords.

Primary LanguageSwiftMIT LicenseMIT

SVPinView

SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords.

Swift 4 compatible CocoaPods compatible Platform iOS License: MIT

demo

Getting Started

An example ViewController is included for demonstrating the functionality of SVPinView.

Installation

CocoaPods

Add the following line to your Podfile:

pod 'SVPinView', '~> 1.0.1'

Then run the following in the same directory as your Podfile:

pod install

Manual

Clone the repo and drag files from SVPinView/Source folder into your Xcode project.

Usage

Storyboard

IBInspectables

Code

  pinView.pinLength = 5
  pinView.secureCharacter = "\u{25CF}"
  pinView.interSpace = 5
  pinView.textColor = UIColor.black
  pinView.underlineColor = UIColor.black
  pinView.underLineThickness = 2
  pinView.shouldSecureText = true
        
  pinView.font = UIFont.systemFont(ofSize: 15)
  pinView.keyboardType = .phonePad
  pinView.pinIinputAccessoryView = UIView()

Callbacks

SVPinView has a 'didFinish' callback, which gets executed after the pin has been entered. This is useful when a network call has to be made or for navigating to a different ViewController after the pin has been entered.

pinView.didFinishCallback = { pin in
   print("The pin entered is \(pin)")
}

Requirements

  • iOS 9.0
  • Xcode 8.0

License

SVPinView is available under the MIT license. See LICENSE for details.