Search code examples
iosswiftnotificationscontacts

How to get changed contacts using Contacts Framework in iOS


I can monitor contacts change using:

NotificationCenter.default.addObserver(
            self, selector: #selector(contactStoreDidChange), name: .CNContactStoreDidChange, object: nil)
    }

@objc func contactStoreDidChange(notification: NSNotification) {

}

But how can I get the changed contacts from the notification? Things like which contact is added/removed/changed etc?


Solution

  • You just can get notify in the method.and you have to then refetch all objects and create your dataSource again for updated data!!