Simple iOS library written in swift, which provides a UITextField
for .oneTimeCode
with a great UX
π¨βπ» iOS 10+ <3 CocoaPods
π¦ΈββοΈ Automatically fills second-factor code from SMS
π§ββοΈ Hidden cursor
π€³ Easy to use
pod 'OneTimeCodeView', '~> 1.0.1'
@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
}