[ios] ContactsUI에서 연락처의 변경 알림을 받는 방법은 무엇인가요?

우선, NotificationCenter에 observer를 등록해야 합니다. 아래의 예시 코드는 ContactsUI가 로드될 때 NotificationCenter에 observer를 등록하고, 연락처가 변경될 때마다 didChangeContactsNotification 메소드를 호출합니다.

import Contacts
import ContactsUI

class YourViewController: UIViewController, CNContactViewControllerDelegate {
    override func viewDidLoad() {
        super.viewDidLoad()

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

    @objc func didChangeContactsNotification(_ notification: Notification) {
        // 연락처가 변경되었을 때 처리할 내용을 여기에 작성합니다.
    }
}

이러한 방식으로 ContactsUI에서 연락처의 변경 알림을 받을 수 있습니다.