You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to set a phone number programmatically before the user starts typing manually but the results are always wrong. When using textfield.text = ... directly, no mask is applied. When using setTextWithMask: the following happens:
Mask = "(###) ###-####"
Text needed: 1234567890, also tried (123) 456-7890
Result: (234) 789-0
Expected: (123) 456-7890
I found a solution in the mean time by setting the text one character at a time:
phoneText.characters.forEach({
let text = phoneTextField.text ?? ""
phoneTextField.setTextWithMask( text + String($0) )
})
The text was updated successfully, but these errors were encountered:
Trying to set a phone number programmatically before the user starts typing manually but the results are always wrong. When using
textfield.text = ...
directly, no mask is applied. When usingsetTextWithMask:
the following happens:Mask = "(###) ###-####"
Text needed: 1234567890, also tried (123) 456-7890
Result: (234) 789-0
Expected: (123) 456-7890
I found a solution in the mean time by setting the text one character at a time:
The text was updated successfully, but these errors were encountered: