Skip to content
Fully Customized pin code(OTP) verification view without storyboard.
Swift
Branch: master
Clone or download
Latest commit 87846f8 Aug 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
PHOTPView.xcodeproj initial commit Aug 14, 2019
PHOTPView initial commit Aug 14, 2019
.gitignore initial commit Aug 14, 2019
README.md Update README.md Aug 14, 2019

README.md

PHOTPView

Fully Customized pin code(OTP) verification view without storyboard.

Getting Started

Features

  • Flawless focus change to the consecutive OTP box when the text is entered/deleted.
  • When the user taps on the Pinview, the first empty box available is focused automatically (when the cursor is hidden).
  • Customisations are available for pin box sizes, font color, border color, inputType etc.

Installation

download project for quick demo.

Manually :

  • Copy and drag the PHOTPView/ folder to your project.

How to Use?

  • create a PHOTPView object
var otpView: PHOTPView!
  • create a PinConfig object
var config : PinConfig = PinConfig()

responsible for all kind of customization

Example:

config.otpFieldDisplayType = .square
config.shouldAllowIntermediateEditing = false
config.otpFieldDefaultBorderColor = UIColor.blue
config.otpFieldEnteredBorderColor = UIColor.green
config.otpFieldErrorBorderColor = UIColor.red
  • initialize view by assigning cofig object
 otpView = PHOTPView(config: config)
 otpView.delegate = self
  • assign delegate
 otpView.delegate = self
  • Finally, Add to your view in which you want to configure OTPview
self.view.addSubview(otpView)
NOTE: Do not forget to initialize UI by calling below method.
otpView.initializeUI()

Prerequisites:

  • xcode 9
  • swift 5

License

MIT

You can’t perform that action at this time.