MaskedUITextField

1.0.0

Create Masked TextFields for UIKit.
Columbina/MaskedUITextField

What's New

v1.0.0

2021-11-03T09:00:35Z

First release of MaskedUITextField

Columbina's MaskedUITextField

A UITextField with fully customizable formatter.

Masked-UIText-Field.gif

Quick start

1. Import the module

import MaskedUITextField

2. Define a MaskedFormatter

Use the MaskedFormatter framework in order to create a mask:

let mask = "##/$$-@@"

let rules = [
    MaskedFormatter.Rule(maskCharacter: "#", validation: { $0.isNumber }),
    MaskedFormatter.Rule(maskCharacter: "$", validation: { $0.isLetter }),
    MaskedFormatter.Rule(maskCharacter: "@", validation: { (Int(String($0)) ?? 0) >= 5 })
]

let maskedFormatter = MaskedFormatter(mask: mask, rules: rules)

3. Instantiate a MaskedUITextField

let textField = MaskedUITextField(formatter: maskedFormatter)

Alternatively:

let textField = MaskedUITextField()
textField.formatter = maskedFormatter

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

Last updated: Sun Aug 28 2022 22:51:17 GMT-0500 (GMT-05:00)