I have a collection view with UICollectionViewDiffableDataSource, which has class PHAssetVisualAssetsPickerItem as it’s ItemIdentifierType. When I create instance of NSDiffableDataSourceSnapshot with the same items that dataSource already has, and then apply it, I see that collection view blinks even tho nothing changed. It actually blinks no matter what new snapshot is.
My investigation led to a fact that methods == (Equatable) and hasher(into:) (Hashable) are not called on items if items are classes. If I change them to structs, methods are called, dataSource understands what to do, nothing blinks.
https://www.icloud.com/iclouddrive/0vnB3auwp0ShEvPQmpVOAy6fg#ApplySnapshotIndexPaths
Here is the code where you can simply change HashableType to either class or struct and see that collectionView update looks different when you tap button.
My investigation led to a fact that methods == (Equatable) and hasher(into:) (Hashable) are not called on items if items are classes. If I change them to structs, methods are called, dataSource understands what to do, nothing blinks.
https://www.icloud.com/iclouddrive/0vnB3auwp0ShEvPQmpVOAy6fg#ApplySnapshotIndexPaths
Here is the code where you can simply change HashableType to either class or struct and see that collectionView update looks different when you tap button.