Programmatically link one CNContact to another, (fast iOS)

I want to associate one contact with a second contact programmatically ...

I connected it with the phone, but could not find any code for it.

 var store = CNContactStore()

 let contact = try store.unifiedContact(withIdentifier: contactIdentifier, keysToFetch:keysToFetch as! [CNKeyDescriptor])
 let contactToUpdate = contact.mutableCopy() as! CNMutableContact

 /* edit or append contact information */

 let saveRequest = CNSaveRequest()
 saveRequest.update(contactToUpdate)
 try store.execute(saveRequest)

enter image description here

+4
source share

Source: https://habr.com/ru/post/1664428/


All Articles