Class

PHChange

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

Declaration

class PHChange : NSObject

Overview

Photos provides PHChange objects to notify your app of changes to the assets and collections managed by the Photos app. To receive change information, adopt the PHPhotoLibraryChangeObserver protocol and register your observer with the shared PHPhotoLibrary object.

After Photos provides you with a change object, you use its methods to get a change details object. Call the changeDetails(for:) or changeDetails(for:) method, passing an asset or collection object you’ve previously fetched or a fetch result containing several such objects. The resulting PHObjectChangeDetails or PHFetchResultChangeDetails object describes any changes that have happened to the object or fetch result since you last fetched it.

Topics

Getting Change Details

func changeDetails<T>(for: T) -> PHObjectChangeDetails<T>?

Returns detailed change information for the specified asset or collection.

func changeDetails<T>(for: PHFetchResult<T>) -> PHFetchResultChangeDetails<T>?

Returns detailed change information for a fetch result.

Relationships

Inherits From

Conforms To

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 register(PHPhotoLibraryChangeObserver)

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

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 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.