register(_:)

register(_:)

register(_:) Instance Method of PHPhotoLibrary Registers an object to receive messages when objects in the photo library change.

func register(_ observer: any PHPhotoLibraryChangeObserver)

Parameters

observer

An object for receiving change messages.

Discussion

You implicitly declare interest in change messages whenever you use a fetch method (such as fetchAssets(with:))) to retrieve assets or collections. After you perform a fetch, Photos automatically sends change messages whenever the objects in the resulting fetch request change—including when changes happen that add to, remove from, or reorder the list of objects in the fetch result.