Latest 1.0.5
Homepage https://github.com/moraisandre/SwiftMaskText
License MIT
Platforms ios 10.0, requires ARC

Release
GitHub issues
GitHub license
GitHub stars
GitHub forks

Carthage Compatible
Pod Compatible

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.

Latest podspec

{
    "name": "SwiftMaskText",
    "version": "1.0.5",
    "homepage": "https://github.com/moraisandre/SwiftMaskText",
    "summary": "A Swift plugin that allow add mask to UITextField.",
    "description": "# SwiftMaskTextnnAnother Swift plugin that allow add mask to UITextFieldnn![App Preview](https://github.com/moraisandre/SwiftMaskText/blob/master/Assets/appPreview.png)nn### Why to use it?n  * Because it's simples and fastn  * Configuration is through Settings Paneln  * Works with Swift 4.0nn## Mask Configurationn### Mask Symbolsnn| Characters | Format |n|:------------:|:------------------------------:|n| N | Number only [0-9] |n| C | Characters [A-Z] (Always upper case) |n| c | Characters [a-z] (Always lower case) |n| X | Characters [a-Z] |n| U | Characters + Numbers [A-Z] + [0-9] (Always upper case) |n| u | Characters + Numbers [a-z] + [0-9] (Always lower case) |n| % | Characters + Numbers [a-Z] + [0-9] |n| * | Any character (Including special ones) |nn### Some examplesnn#### Internacional examplesnn| Field | Mask |n|:------------:|:------------------------------:|n| SSN | NNN-NN-NNNN |n| Telephone | +NN (NNN) NNN-NNNN |n| Credit Card | NNNN-NNNN-NNNN-NNNN |nn#### Brazilian examplesnn| Field | Mask |n|:------------:|:------------------------------:|n| Telephone | +NN (0NN) NNNNN-NNNN |n| CPF | NNN.NNN.NNN-NN |n| RG | NN.NNN.NNN-% |n| CEP | NNNNN-NNN |nnn## How to use it?n#### Using Carthagenn  ```n  github "moraisandre/SwiftMaskText"n  ```n#### Using CocoaPodsnn  ```n  pod u2018SwiftMaskTextu2019n  ```n#### Copy files to your projectnn1. Add the *SwiftMaskField* folder to your project, it contains 2 files. Be sure that *'Copy items if needed'* is checked.n    ![Copy Items If Needed](https://github.com/moraisandre/SwiftMaskText/blob/master/Assets/CopyItemsIfNeeded.png)nn2. In your *ViewController* add an *UITextField* object. In 'Settings Panel' -> 'Identity inspector' set Class to *'SwiftMaskField'*n    ![Custom Class](https://github.com/moraisandre/SwiftMaskText/blob/master/Assets/customClass.png)nnn3. Now go into 'Settings Panel' -> 'Attributes inspector' and set the Mask that you want it ton    ![Swift Mask Field](https://github.com/moraisandre/SwiftMaskText/blob/master/Assets/swiftMaskField.png)nn4. Done!nn## More infon### Authorn*Andru00e9 Morais*nnWebsite: www.andremorais.com.brnnE-mail: [[email protected]](mailto:[email protected]?Subject=GitHub%20doubt)nn### LicensenUnder the [MIT license](http://www.opensource.org/licenses/MIT).",
    "authors": "Andre Morais",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/moraisandre/SwiftMaskText.git",
        "tag": "1.0.5"
    },
    "source_files": "SwiftMaskText/Source/*.swift",
    "module_name": "SwiftMaskText",
    "requires_arc": true,
    "pushed_with_swift_version": "4"
}

Pin It on Pinterest

Share This