iosswiftcncontactcncontactstore

CNContacts -- Address Line 2


How do we get the address line 2 for a specific contact address. I am able to successfully get the address line 1 using

cnContact.postalAddresses.first?.value.street

What property do we use to get the address line 2?

Also, how do we prioritize the home address to be displayed rather than the work address? Is this possible?


Solution

  • postalAddresses.first?.value.street is the full (line 1 and, if present, line 2) of the FIRST postalAddress in an ARRAY of postalAddresses for a Contact (cnContact). It is not, as you state, "line 1".