Post

Replies

Boosts

Views

Activity

Reply to diffable data source can't identify items?
The points made by the engineer from Apple in this thread are inconsistent with this doc. Above: Diffable's notion of identity is based on the isEqual: implementation of the object. In the doc A diffable data source stores a list of section and item identifiers, which represents the identity of each section and item contained in a collection view. These identifiers are stable, meaning they don’t change. Because identifiers are hashable and equatable, a diffable data source can determine the differences between its current snapshot and another snapshot. Then it can insert, delete, and move sections and items within a collection view for you based on those differences, eliminating the need for custom code that performs batch updates. Apple's docs and Apple's engineers don't seem to agree on the behaviour here. Based on the info in the doc, a difference in the fields used for implementing the hash and equality functions should be sufficient to determine that a position change and a content change has happened simultaneously, but that does not appear to be the case in practice.
Aug ’22