Posts

Post not yet marked as solved
10 Replies
As I found recently, - https://stackoverflow.com/a/61091958/1767388 you just need to add other properties of the model structure to the Equatable protocol function in case you want your own ==. After that, data source can figure out the difference and will update item correctly. struct MyItem: Hashable {		 let identifier = UUID().uuidString // We just need an ID, right?				 var value: String? func hash(into hasher: inout Hasher) {				 hasher.combine(identifier)		 }				 /* Optional solution here, in case you don’t want to check all properties for equality, or if any of your properties are not also Equatable. In other words, you don't need to overload it and leave default implementation */ static func == (lhs: MyItem, rhs: MyItem) -> Bool {				 return lhs.identifier == rhs.identifier && lhs.value == rhs.value // Boom! It just works ;-) } }