In iOS 12 Apple has introduced feature called Security Code AutoFill
.
To use this in your app all you need to do is set UITextField
's input view’s textContentType
property oneTimeCode
.
otpTextField.textContentType = .oneTimeCode
NOTE: Security Code AutoFill will only works with System Keyboard it will not work with custom keyboard.
WWDC video
When you get OTP it will look something like this:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…