Basic lightweight email validation. The aim of this library is to simply validation if a email structure is valid. Built on top of NSDataDetector, this library provides a robust way to validate an email structure.
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate EmailValidator into your Xcode project using Carthage, specify it in your Cartfile
:
github "jwelton/EmailValidator"
Run carthage update
to build the framework and drag the built EmailValidator.framework
into your Xcode project.
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate EmailValidator into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'EmailValidator'
end
Then, run the following command:
$ pod install
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. It is in early development, but EmailValidator does support its use on supported platforms.
Once you have your Swift package set up, adding EmailValidator as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.Package(url: "https://github.com/jwelton/EmailValidator.git", majorVersion: 1)
]
dependencies: [
.package(url: "https://github.com/jwelton/EmailValidator.git", from: "1.0.0")
]
import EmailValidator
let result = EmailValidator().validate("test@example.com")
switch result {
case .valid: print("Yay its valid!")
case .invalid: print("Sorry, email is invalid")
}
Feel free to dive in! Open an issue or submit PRs.
MIT © Jake Welton