5

I am using UICollectionViewDiffableDataSource to fill UICollectionView with data. My understanding is that DiffableDataSource compares items by using == and then if items are equal it compares hash values to see if something changed.

But according to the error I am getting this isn't the case.

Diffable data source detected item identifiers that are equal but have different hash values. Two identifiers which compare as equal must return the same hash value. You must fix this in the Hashable (Swift) or hash property (Objective-C) implementation for the type of these identifiers

In my case I have item that I compare against uniqueID and hashValue is determined by value that user entered. What is the point of using == and hashValue if they can't be different?

Josip B.
  • 2,434
  • 1
  • 25
  • 30

0 Answers0