i'm using the library "PhoneNumberKit" to format a UITextfield i'm using on my app that i use it to input phone number.
i am using PartialFormatter to format the input into a phone number mask style.
@IBAction func onPhoneNumberChanged(_ sender: Any) {
if (phoneNumberTextField.text?.count ?? 0 < 15) {
phoneNumberTextField.text = PartialFormatter().formatPartial(phoneNumberTextField.text ?? "")
} else {
phoneNumberTextField.deleteBackward()
}
}
my problem is that it always format the string to a LOCAL phone number, i want to force it to format it into a US phone number mask.
the library say:
The default region code is automatically computed but can be overridden if needed.
but doesn't give any examples on force region code to be to a specific country
here is the library i'm using: https://github.com/marmelroy/PhoneNumberKit
does someone here has any exmaples on how to do it ?
thanks