Address

public struct Address : Encodable

The Address struct represents an email address and contains the email address along with an optional display name.

  • An optional name to display instead of the email address.

    Declaration

    Swift

    public let name: String?
  • An email address.

    Declaration

    Swift

    public let email: String
  • Initializes the address with an email address and an optional display name.

    Declaration

    Swift

    public init(email: String, name: String? = nil)

    Parameters

    email

    The email address.

    name

    An optional display name.

  • Validates that the email address is an RFC compliant email address.

    Declaration

    Swift

    public func validate() throws
  • This initializer allows you to create an Address instance from a String:

    let address: Address = "foo@bar.none"
    

    Declaration

    Swift

    public init(stringLiteral value: String)

    Parameters

    value

    The email address to use in the Address.