Generic Class

PHObjectChangeDetails

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

Declaration

class PHObjectChangeDetails<ObjectType> : NSObject where ObjectType : PHObject

Overview

A PHObjectChangeDetails object provides detailed information about differences between two states of an asset or collection object—one that you previously obtained and an updated state that would result if you fetched that entity again. You observe changes by adopting the PHPhotoLibraryChangeObserver protocol and registering your observer with the shared PHPhotoLibrary object. When Photos notifies your observer of a change, you get change details by passing the object you’re interested in to the changeDetails(for:) method.

For an asset collection or collection list, a PHObjectChangeDetails object describe changes only to the collection’s properties. If you are instead interested in changes to the collection’s membership, fetch the collection’s contents and use the changeDetails(for:) method to track changes to the fetch result.

Topics

Getting the Changed Object

var objectBeforeChanges: ObjectType

An object that reflects the original state of the asset or collection it represents.

var objectAfterChanges: ObjectType?

An object that reflects the current state of the asset or collection it represents.

Getting Change Information

var assetContentChanged: Bool

A Boolean value that indicates whether the asset’s photo or video content has changed.

var objectWasDeleted: Bool

A Boolean value that indicates whether the object has been deleted from the Photos library.

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 PHChange

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

class PHFetchResultChangeDetails

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