getVerificationCode method returns string with whitespace.
Closed this issue · 4 comments
getVerificationCode return string with a whitespace.
I was trying to get the count of the string returned by getVerificationCode(). It alwasy shows 1 extra count since it has a whitespace
@abhijithpp I tried to reproduce the issue but couldn't. Tried via IB & programatically. Can you give steps to reproduce this?
In the mean time you can trim the whitespaces using the following code:
code.trimmingCharacters(in: CharacterSet.whitespaces)
@abhijithpp if you want only 3 digits you need to set otpTextFieldView.digits = 3
If you are trying to validate the code using the code count, you can use the method otpTextFieldView.hasValidCode()
which returns true
if all the digits are filled, false
if there are empty fields
Check our example project for clear implementation regarding the same.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.