1

I have a TextField object where the user enters in a phone number. Currently, it looks like normal numbers and I want it to look like a phone format, so (xxx) xxx-xxxx. I tried out by changing the Content Type of the TextField in the Storyboard to "Telephone number", but it didn't help.

Is there any helper function or code that I can use to format the integers in a textfield to look like a phone number (as the user types the numbers)?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 3
    You might look at [PhoneNumberKit](https://github.com/marmelroy/PhoneNumberKit) or [Formattting Phone number in Swift](https://stackoverflow.com/questions/32364055/formattting-phone-number-in-swift) or [Formatting phone numbers in Swift](https://ivrodriguez.com/format-phone-numbers-in-swift/) – MadProgrammer Jul 04 '18 at 04:47
  • one more alternative https://github.com/Serheo/SHSPhoneComponent – Gökhan Aydın Jul 04 '18 at 05:54

0 Answers0