A protocol you can implement to be notified of changes that occur in the photo library.
Mac Catalyst 13.0+
The PHPhotoLibraryChangeObserver protocol notifies you of changes that occur in the Photos library, regardless of whether those changes are made by your app, by a user in the Photos app, or by another app that uses the Photos framework. To receive change messages, register your observer with the photo library’s registerChangeObserver: method. For any assets or collections that you fetch, Photos sends change messages whenever those assets or collections change. Use this protocol to track changes across multiple parts of your app or respond to changes made in another app or extension.
Handling Changes: An Example
The example code below shows how you might implement this protocol in a view controller that uses a UICollectionView interface to display the contents of an album. The view controller keeps a reference to the PHAssetCollection object representing the displayed album and the PHFetchResult object (returned by the fetchAssetsInAssetCollection:options: method) listing the album’s contents. Then, in its photoLibraryDidChange: method, the view controller checks for differences between the objects it fetched and the new state of the photo library, and updates its collection view accordingly.