Is this the shortcoming of DiffableDataSource?

Most examples given are only capable to detect data movement, insertion, deletion, but not content modification.

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
  1. Compare identify to detect movement, insertion, deletion

  2. Compare content to detect modification

Currently, func == can only either compare identify, or compare content, but not both!

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
  1. Compare identify to detect movement, insertion, deletion

  2. Compare content to detect modification

Thanks.

Hi @yccheok, I recently discovered that they have made the improvements mentioned in your post. Although these improvements are not recorded in the documentation or wwdc, according to my tests, it works at least starting from iOS 16.

Is this the shortcoming of DiffableDataSource?
 
 
Q