PostalAddress

public struct PostalAddress : Equatable, Encodable

The model for address data.

  • Create new instance of postal address.

    Declaration

    Swift

    public init(city: String? = nil,
                country: String? = nil,
                houseNumberOrName: String? = nil,
                postalCode: String? = nil,
                stateOrProvince: String? = nil,
                street: String? = nil,
                apartment: String? = nil)
  • The name of the city.

    Declaration

    Swift

    public var city: String?
  • The two-character country code as defined in ISO-3166-1 alpha-2. For example, US. If you don’t know the country or are not collecting the country from the shopper, provide country as ZZ.

    Declaration

    Swift

    public var country: String?
  • The number or name of the house.

    Declaration

    Swift

    public var houseNumberOrName: String?
  • A maximum of five digits for an address in the US, or a maximum of ten characters for an address in all other countries.

    Declaration

    Swift

    public var postalCode: String?
  • State or province codes as defined in ISO 3166-2. For example, CA in the US or ON in Canada. Required for the US and Canada.

    Declaration

    Swift

    public var stateOrProvince: String?
  • The name of the street. The house number should not be included in this field; it should be separately provided via houseNumberOrName.

    Declaration

    Swift

    public var street: String?
  • The name or code of apartment. Optional. Will be included into houseNumberOrName.

    Declaration

    Swift

    public var apartment: String?
  • Encodes this address info into the given encoder.

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws