CNContactDisplayNameOrder (contacts framework)

1. How to determine the user's default CNContactDisplayNameOrder ? I can't find it in CNContactsUserDefaults

2. How to get display name string based on the CNContactDisplayNameOrder ? Do I have to manually build it or is there a better way ?

Replies

1. How to determine the user's default CNContactDisplayNameOrder ? I can't find it in CNContactsUserDefaults

As for now, this is the only method which returns CNContactDisplayNameOrder, as you may already know, it does not return the user's default, but the specified contact's display name order.

+ nameOrderForContact: in the CNContactFormatter Class Reference


2. How to get display name string based on the CNContactDisplayNameOrder ? Do I have to manually build it or is there a better way ?

As described in the Contacts Framework Reference, using CNContactFormatter seems to be the only way:

        // Formatting contact name
        let fullName = CNContactFormatter.stringFromContact(contact, style: .FullName)
        print(fullName)
        // John Appleseed