I know that I can sort with CNContacts like this:
let fetch = CNContactFetchRequest(...)
fetch.sortOrder = .UserDefault
The question is: how do I find what is that sort order? Apart from some hacky heuristic of examining what comes back from the fetch enumeration.
There is an old ABPersonGetSortOrdering() call that will probably stay around for a while, but surely there is a CNContact way to do it.
ABPersonGetSortOrdering()
was deprecated in iOS 9.0: use [[CNContactsUserDefaults sharedDefaults] sortOrder]
let sortOrder = CNContactsUserDefaults.sharedDefaults().sortOrder
Swift 4
Using the default sort Order :
let sortOrder = CNContactsUserDefaults.shared().sortOrder
For Custom Sort Order i.e.
let customSortOrder = CNContactSortOrder.givenName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With