Skip to content

Instantly share code, notes, and snippets.

@douglastaquary
Created January 19, 2017 00:15
Show Gist options
  • Select an option

  • Save douglastaquary/0c80b6c1787ff3acaa3327468d79ba4d to your computer and use it in GitHub Desktop.

Select an option

Save douglastaquary/0c80b6c1787ff3acaa3327468d79ba4d to your computer and use it in GitHub Desktop.
Função para validar campo de email
func stringIsEmailAddress(_ text: String) -> Bool {
let emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}"
let testPredicate = NSPredicate(format:"SELF MATCHES %@", emailRegex)
return testPredicate.evaluate(with: text)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment