OneTimeCodeView
Simple iOS library written in swift, which provides a UITextField for .oneTimeCode with a great UX
Installation
pod 'OneTimeCodeView', '~> 1.0.1'
Filled code view
Empty view
Usage
@IBOutlet weak var oneTimeCodeView: OneTimeCodeView!
override func viewDidAppear(_ animated: Bool) {
// required:
self.oneTimeCodeView.configure(countOfDigits: NUMBER_COUNT)
self.oneTimeCodeView.didEnterLastDigit = { [weak self] (code) -> () in
print(code)
// TODO verify the code
}
}
// (optional) if you want to clear OneTimeCodeView if verification fails
func onVerificationError(error: Error) {
self.oneTimeCodeView.clear()
// display an error message
}

