Contents

attributedString(from:withDefaultAttributes:)

Returns a formatted postal address as an attributed string.

Declaration

func attributedString(from postalAddress: CNPostalAddress, withDefaultAttributes attributes: [AnyHashable : Any] = [:]) -> NSAttributedString

Parameters

Return Value

The formatted postal address as an attributed string.

Discussion

This method behaves similarly to string(from:), except that it returns an attributed string. It includes the attribute key CNPostalAddressPropertyAttribute, whose attribute values are postal address property keys, such as CNPostalAddressStreetKey. This identifies the postal address components in the formatted postal address. It also includes the attribute key CNPostalAddressLocalizedPropertyNameAttribute whose attribute values are the localized strings for the postal address property keys.

See Also

Generating a formatted attributed string