Created
September 1, 2017 08:17
-
-
Save StanislavK/d140e6e4eccd89732acb63454e9b1470 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension String { | |
var isValidEmail: Bool { | |
let emailFormat = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}" | |
let emailPredicate = NSPredicate(format:"SELF MATCHES %@", emailFormat) | |
return emailPredicate.evaluate(with: self) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment