Como faço para usar VMaskTextField com o Swift?
self.comVM.mask = "###(##)##"
Exemplo:
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);
}
}
Não se esqueça de trocar a classe do UITextField
para VMaskTextField
no storyboard/nib .