-
Notifications
You must be signed in to change notification settings - Fork 96
Quick Start
Egor Taflanidi edited this page Feb 6, 2019
·
4 revisions
Given you have already installed our library, let's get started and put together a small project.
Drop an object on your scene and cofigure it as a MaskedTextFieldDelegate:

Assign your UITextField.delegate to be this object:

Make sure your ViewController knows its residents:

open class ViewController: UIViewController {
@IBOutlet weak var listener: MaskedTextFieldDelegate!
@IBOutlet weak var field: UITextField!
}Check that your object's Primary Mask Format contains a proper mask pattern:
+7 ([000]) [000] [00] [00]
Prepare for receiving text changed events by assigning your ViewController as a delegate to MaskedTextFieldDelegate object:

Make your ViewController to implement MaskedTextFieldDelegateListener:
open class ViewController: UIViewController, MaskedTextFieldDelegateListener {
@IBOutlet weak var listener: MaskedTextFieldDelegate!
@IBOutlet weak var field: UITextField!
open func textField(
_ textField: UITextField,
didFillMandatoryCharacters complete: Bool,
didExtractValue value: String
) {
print(value)
}
}All set. Run.
Sample project is located under the Source/Sample.