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: Sat Oct 19 2024 04:45:49 GMT-0900 (Hawaii-Aleutian Daylight Time)