PHFetchResultChangeDetails
A description of changes that occurred in the set of asset or collection objects listed in a fetch result.
Declaration
class PHFetchResultChangeDetails<ObjectType> where ObjectType : PHObjectOverview
A PHFetchResultChangeDetails object provides detailed information about the differences between two fetch results—one that you previously obtained and an updated one that would result if you performed the same fetch again. The change details object provides information useful for updating a UI that lists the contents of a fetch result, such as the indexes of added, removed, and rearranged objects.
Processing Changes in Order
PhotoKit describes changedIndexes in the after state, while UICollectionVieww’s performBatchUpdates(_:completion:) expects them in the before state. As a result, changedIndexes can’t be used safely inside performBatchUpdates(_:completion:).
Instead, use changedIndexes after and outside the performBatchUpdates(_:completion:) call, reapplying the code used to configure cells in cellForItem(at:) rather than telling UICollectionView to reload.
Topics
Getting the Changed Fetch Result
Getting Change Information
hasIncrementalChangesremovedIndexesremovedObjectsinsertedIndexesinsertedObjectschangedIndexeschangedObjectshasMovesenumerateMoves(_:)