PHObjectChangeDetails
PHObjectChangeDetails
PHObjectChangeDetails Class of Photos A description of changes that occurred in an asset or collection object.
class PHObjectChangeDetails<ObjectType> where ObjectType : PHObjectOverview
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 changeDetailsForObject: method.
For an asset collection or collection list, a PHObjectChangeDetails object describe changes only to the collection’s properties. If you’re instead interested in changes to the collection’s membership, fetch the collection’s contents and use the changeDetails(for:)-33a6n) method to track changes to the fetch result.
Warning: Don’t map `
doc://com.apple.photokit/documentation/Photos/PHFetchResultChangeDetails/changedIndexesdirectly to //com.apple.documentation/documentation/UIKit/UICollectionView item indices in batch updates. Use these indices to reconfigure the corresponding cells after //com.apple.documentation/documentation/UIKit/UICollectionView/performBatchUpdates(:completion:)). //com.apple.documentation/documentation/UIKit/UICollectionView and //com.apple.documentation/documentation/UIKit/UITableView expect thedoc://com.apple.photokit/documentation/Photos/PHFetchResultChangeDetails/changedIndexes` to be in the before state, while PhotoKit provides them in the after state, resulting in a crash if your app performs insertions and deletions at the same time as the changes.