How do I use VMaskTextField with Swift?
self.comVM.mask="### (##) ##"
How do I use VMaskTextField with Swift?
self.comVM.mask="### (##) ##"
Example:
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var comVM: VMaskTextField!
override func viewDidLoad() {
super.viewDidLoad()
comVM.mask = "(##) ####-####";
comVM.delegate = self;
}
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
return comVM.shouldChangeCharactersInRange(range, replacementString: string);
}
}
Do not forget to change the class from UITextField
to VMaskTextField
on storyboard / nib.