Skip to content

Lightweight email validation for iOS, macOS and tvOS.

License

Notifications You must be signed in to change notification settings

jwelton/EmailValidator

Repository files navigation

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("[email protected]")

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

About

Lightweight email validation for iOS, macOS and tvOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published