Apple has introduced new Contacts Framework in iOS 9, which replaces the AddressBook framework. Accessing contacts information using AddressBook framework was very tough task for developer. But new Contacts framework of iOS 9 provides very easy methods to access Contact information. Contacts Framework provides contacts not only from database of you iphone or ipad device but also from various sources like iCloud account and then return the associated contacts. We can also search and filter the contacts using this Contacts Framework.
1) Make an instance of CNContactStore
let store = CNContactStore()
2) Add keys which you required in user contact info
let keysToFetch = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactPhoneNumbersKey,CNContactNicknameKey]
In above code , we are fetching user name , family name ,phone number and user nickname.