Instance Method

register(_:)

Registers an object to receive messages when objects in the photo library change.

Declaration

func register(_ observer: 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.

See Also

Observing Changes to the Photo Library

Observing Changes in the Photo Library

Register an observer to be notified of changes to the photo library.

func unregisterChangeObserver(PHPhotoLibraryChangeObserver)

Unregisters an object so that it no longer receives change messages.

protocol PHPhotoLibraryChangeObserver

A protocol you can implement to be notified of changes that occur in the photo library.

class PHChange

A description of a change that occurred in the photo library.

class PHObjectChangeDetails

A description of changes that occurred in an asset or collection object.

class PHFetchResultChangeDetails

A description of changes that occurred in the set of asset or collection objects listed in a fetch result.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software