APAddressBook
APAddressBook copied to clipboard
how to display contacts sorted alphabetically
Not sure where to post and this is not a bug. In phone book we can have contacts stored with out name and inside the contact details we can have mobile number and email id. If the contact is stored with out name and has only email id we need to display the email id as name and if the contact is stored with multiple email ids and no name then the first email id to be displayed and if the contact is stored with mobile number and no name then the mobile number needs to be displayed. How to perform the same using this library?
let name = contact.name?.compositeName ?? contact.emails?.first?.address ?? contact.phones?.first?.number ?? "Can't display name for this contact"