Posts

Post not yet marked as solved
10 Replies
0 Views
The way of iOS to implement Diffable Data Source obviously has a major flaw. It is not able to detect, when the content changed and position moved happen at the same time on an item. If we look how Android implements their version of "Diffable Data Source" - DiffUtil. It comes with 2 functions areContentsTheSame(int oldItemPosition, int newItemPosition) - Called by the DiffUtil when it wants to check whether two items have the same data. and areItemsTheSame(int oldItemPosition, int newItemPosition) - Called by the DiffUtil to decide whether two object represent the same Item. As pointed out by yetanotherme , besides the ability to detect content change, iOS's Diffable Data Source need a way to distinguish whether 2 items are having same identify. Same analogy is... Yesterday my hair color is black, today my hair color is white (Content change. In Android, this is detected using areContentsTheSame) But, Yesterday me and today me are still referring to the same me (Same identify. In Android, this is detected using areItemsTheSame)