Skip to content

Instantly share code, notes, and snippets.

@thatswiftguy
Created May 19, 2021 09:33
Show Gist options
  • Save thatswiftguy/05797057c06d0ee64b311d7a471b2ce9 to your computer and use it in GitHub Desktop.
Save thatswiftguy/05797057c06d0ee64b311d7a471b2ce9 to your computer and use it in GitHub Desktop.
func isValidEmail(_ email: String) -> Bool {
let emailCode = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
let emailPredicate = NSPredicate(format:"SELF MATCHES %@", emailCode)
return emailPredicate.evaluate(with: email)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment