Skip to content

Latest commit

 

History

History
102 lines (67 loc) · 2.83 KB

README.md

File metadata and controls

102 lines (67 loc) · 2.83 KB

EmailValidator

CocoaPods Compatible Carthage Compatible Platforms License

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.

Installation

Carthage

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

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

Swift Package Manager

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.

Swift 3

dependencies: [
    .Package(url: "https://github.com/jwelton/EmailValidator.git", majorVersion: 1)
]

Swift 4

dependencies: [
    .package(url: "https://github.com/jwelton/EmailValidator.git", from: "1.0.0")
]

Usage example

import EmailValidator

let result = EmailValidator().validate("test@example.com")

switch result {
    case .valid: print("Yay its valid!")
    case .invalid: print("Sorry, email is invalid")
}

Maintainers

@JWelton

Contribute

Feel free to dive in! Open an issue or submit PRs.

License

MIT © Jake Welton