Skip to content

Another Swift plugin that allow add mask to UITextField

License

Notifications You must be signed in to change notification settings

andre991/SwiftMaskText

 
 

Repository files navigation

Repository Version Carthage Compatible Pod Compatible

SwiftMaskText

Another Swift plugin that allow add mask to UITextField

Why to use it?

  • 'Cos it's simples and fast
  • Configuration is through Settings Panel
  • Works with Swift 3.0 (Thanks to @andre991)

Mask Configuration

Mask Symbols

Character 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.
  2. In your ViewController add an UITextField object. In 'Settings Panel' -> 'Identity inspector' set Class to 'SwiftMaskField'
  3. Now go into 'Settings Panel' -> 'Attributes inspector' and set the Mask that you want it to
  4. Done!

More info

Author

André Morais
Website: www.andremorais.com.br
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 96.1%
  • Ruby 2.0%
  • Objective-C 1.9%