Skip to content

Another Swift plugin that allow add mask to UITextField

License

Notifications You must be signed in to change notification settings

joaodforce/SwiftMaskText

 
 

Repository files navigation

Release GitHub issues GitHub license GitHub stars GitHub forks

Carthage Compatible Pod Compatible

SwiftMaskText

Another Swift plugin that allow add mask to UITextField

App Preview

Why to use it?

  • Because it's simples and fast
  • Configuration is through Settings Panel
  • Works with Swift 4.0

Mask Configuration

Mask Symbols

Characters Format
N Number only [0-9]
C Characters [A-Z] (Always upper case)
c Characters [a-z] (Always lower case)
X Characters [a-Z]
U Characters + Numbers [A-Z] + [0-9] (Always upper case)
u Characters + Numbers [a-z] + [0-9] (Always lower case)
% Characters + Numbers [a-Z] + [0-9]
* Any character (Including special ones)

Some examples

Internacional examples

Field Mask
SSN NNN-NN-NNNN
Telephone +NN (NNN) NNN-NNNN
Credit Card NNNN-NNNN-NNNN-NNNN

Brazilian examples

Field Mask
Telephone +NN (0NN) NNNNN-NNNN
CPF NNN.NNN.NNN-NN
RG NN.NNN.NNN-%
CEP NNNNN-NNN

How to use it?

Using Carthage

github "moraisandre/SwiftMaskText"

Using CocoaPods

pod ‘SwiftMaskText’

Copy files to your project

  1. Add the SwiftMaskField folder to your project, it contains 2 files. Be sure that 'Copy items if needed' is checked. Copy Items If Needed

  2. In your ViewController add an UITextField object. In 'Settings Panel' -> 'Identity inspector' set Class to 'SwiftMaskField' Custom Class

  3. Now go into 'Settings Panel' -> 'Attributes inspector' and set the Mask that you want it to Swift Mask Field

  4. Done!

More info

Author

André Morais

Website: moraisandre.com/swiftmasktext

E-mail: [email protected]

License

Under the MIT license.

About

Another Swift plugin that allow add mask to UITextField

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 87.6%
  • Ruby 10.7%
  • Objective-C 1.7%