Alterplay / APAddressBook

Easy access to iOS address book
MIT License
1.38k stars 193 forks source link

how to display contacts sorted alphabetically #154

Open techwizardg opened 7 years ago

techwizardg commented 7 years ago

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?

belkevich commented 7 years ago
let name = contact.name?.compositeName ?? contact.emails?.first?.address ?? contact.phones?.first?.number ?? "Can't display name for this contact"