<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Contacts",
  "identifier" : "/documentation/Contacts/CNPostalAddressFormatter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Contacts"
    ],
    "preciseIdentifier" : "c:objc(cs)CNPostalAddressFormatter"
  },
  "title" : "CNPostalAddressFormatter"
}
-->

# CNPostalAddressFormatter

An object that you use to format a contact’s postal addresses.

```
class CNPostalAddressFormatter
```

## Overview

A `CNPostalAddressFormatter` object handles international formatting of postal addresses. It is recommended that you create an instance of this class when formatting many postal addresses, and use the instance methods; otherwise use the class methods.

## Topics

### Generating a formatted attributed string

[`attributedString(from:withDefaultAttributes:)`](/documentation/Contacts/CNPostalAddressFormatter/attributedString(from:withDefaultAttributes:))

Returns a formatted postal address as an attributed string.

[`attributedString(from:style:withDefaultAttributes:)`](/documentation/Contacts/CNPostalAddressFormatter/attributedString(from:style:withDefaultAttributes:))

Returns a postal address as an attributed string and formatted for the specified style.

[`CNPostalAddressPropertyAttribute`](/documentation/Contacts/CNPostalAddressPropertyAttribute)

An attribute that identifies the purpose of a range of characters in an attributed string.

[`CNPostalAddressLocalizedPropertyNameAttribute`](/documentation/Contacts/CNPostalAddressLocalizedPropertyNameAttribute)

An attribute that identifies the localized property of postal address.

### Generating a formatted string

[`string(from:)`](/documentation/Contacts/CNPostalAddressFormatter/string(from:))

Returns a formatted postal address.

[`string(from:style:)`](/documentation/Contacts/CNPostalAddressFormatter/string(from:style:))

Returns a postal address as a string and formatted for the specified style.

### Specifying the formatting style

[`style`](/documentation/Contacts/CNPostalAddressFormatter/style)

The style to apply when formatting strings.

[`CNPostalAddressFormatterStyle`](/documentation/Contacts/CNPostalAddressFormatterStyle)

Constants for postal formatting styles.

### Getting the postal attribute keys

[`CNPostalAddressCityKey`](/documentation/Contacts/CNPostalAddressCityKey)

The city of the address.

[`CNPostalAddressCountryKey`](/documentation/Contacts/CNPostalAddressCountryKey)

The country or region name of the address.

[`CNPostalAddressISOCountryCodeKey`](/documentation/Contacts/CNPostalAddressISOCountryCodeKey)

The ISO country code of the address.

[`CNPostalAddressPostalCodeKey`](/documentation/Contacts/CNPostalAddressPostalCodeKey)

The postal code of the address.

[`CNPostalAddressStateKey`](/documentation/Contacts/CNPostalAddressStateKey)

The state name of the address.

[`CNPostalAddressStreetKey`](/documentation/Contacts/CNPostalAddressStreetKey)

The street name of the address.

[`CNPostalAddressSubAdministrativeAreaKey`](/documentation/Contacts/CNPostalAddressSubAdministrativeAreaKey)

The subadministrative area of the address.

[`CNPostalAddressSubLocalityKey`](/documentation/Contacts/CNPostalAddressSubLocalityKey)

The sublocality of the address.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)