How can I validate in 2 textfield
if the data you are entering are:
An email and a phone number ??
I have this code:
campoMovil.keyboardType = .numberPad
campoEmail.keyboardType = .emailAddress
How can I validate in 2 textfield
if the data you are entering are:
An email and a phone number ??
I have this code:
campoMovil.keyboardType = .numberPad
campoEmail.keyboardType = .emailAddress
When you finish collecting the values you pass this filter:
class func isOnlyNumbers(string: String) -> Bool {
return NSPredicate(format: "SELF MATCHES %@", "\d{10}").evaluateWithObject(string)
}
class func isValidEmail(string: String) -> Bool {
let emailReg = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}"
let emailTest = NSPredicate(format:"SELF MATCHES %@", emailReg)
return emailTest.evaluateWithObject(string)
}