0

I would like to know how can I implement a mask in Swift to format the input in a UITextField in real time as a Telephone number. I was looking for but I've only found complex code, I think it would be more simple. Correct me if I'm wrong. The desired mask I describe below.

000-00-00-00
Edu
  • 460
  • 12
  • 33

2 Answers2

2

Maybe you want to checkout this pod i've created some while ago:

TLCustomMask

It is really simple to use.

result:

enter image description here

Edudjr
  • 1,321
  • 13
  • 26
0

It is not that simple. Anyway this question is already answered here.

Or you can look for a library in the github such as: PhoneNumberKit

Community
  • 1
  • 1
ridvankucuk
  • 2,388
  • 1
  • 22
  • 40