Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

apploft/APLEmailAddress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APLEmailAddress

APLEmailAddress contains the class EmailAddressDetector to detect valid email-Addresses in a string and return instances of the EmailAddressProtocol.

Installation

Add this to your Podfile:

pod "APLEmailAddress"

Usage

Create an instance of EmailAddressDetector and use their methods to detect and create EmailAddress objects.

let emailAddressDetector: EmailAddressDetector = EmailAddressDetectorImpl()

EmailAddressDetector

func detect(_ emailString: String) -> [EmailAddress]?

This function takes a string as input, uses the NSDataDetector to detect all valid email-addresses within that string and returns a list of valid EmailAddress objects.

func detectSolely(_ emailString: String) -> EmailAddress?

This is a convenience function that detects the first valid email-address within a given string, checks wether it is the only one and returns it in that case.

EmailAddress

EmailAddress is a protocol that implements the get-only property asString which returns the valid email-address as String.

The protocol also implements Hashable, Equatable and CustomStringConvertible. To access these Hashable, Equatable and CustomStringConvertible protocols the object EmailAddress needs to be converted to AnyHashableEmailAddress with the method asHashable().

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published