Most examples given are only capable to detect data movement, insertion, deletion, but not content modification.
This is because func == only compare identifier, but not content.
Even if I modify the class to
The outcome is not perfect still. As, it still fail to detect when an item is being modified and being moved at the same time.
Isn't a good Diff library should have the ability to
I posted my finding here - https://stackoverflow.com/questions/64293965/is-it-possible-to-have-diffabledatasource-correctly-handle-item-move-item-modif
Is there any plan to further improve DiffableDataSource, so that we can
Code Block class WiFiController { struct Network: Hashable { let name: String let identifier = UUID() func hash(into hasher: inout Hasher) { hasher.combine(identifier) } static func == (lhs: Network, rhs: Network) -> Bool { return lhs.identifier == rhs.identifier } }
This is because func == only compare identifier, but not content.
Even if I modify the class to
Code Block class WiFiController { struct Network: Hashable { let name: String let identifier = UUID() func hash(into hasher: inout Hasher) { hasher.combine(name, identifier) } static func == (lhs: Network, rhs: Network) -> Bool { return lhs.name == rhs.name && lhs.identifier == rhs.identifier } }
The outcome is not perfect still. As, it still fail to detect when an item is being modified and being moved at the same time.
Isn't a good Diff library should have the ability to
Compare identify to detect movement, insertion, deletion
Compare content to detect modification
I posted my finding here - https://stackoverflow.com/questions/64293965/is-it-possible-to-have-diffabledatasource-correctly-handle-item-move-item-modif
Is there any plan to further improve DiffableDataSource, so that we can
Compare identify to detect movement, insertion, deletion
Compare content to detect modification