I am also seeing this issue @rolandkajatin. Coincidentally, my @Transient marked property is also using HealthKit with a type of HKCategorySample?.
Post
Replies
Boosts
Views
Activity
After much time messing with this, it appears that this internal exception is usually thrown when using a struct for your model object with inferred Hashable conformance. It can also happen sometimes with a class if you do something wonky with your Hashable conformance, but I can't see to put my finger on it.
This is the only way I could get it to work. In my case I am receiving an update from my app server that includes everything that should be displayed in the list. Simply applying the snapshot didn't cause the cells that remained in place to update.
By dispatching a reload call on the main queue, I was able to successfully get those cells to reload their views.
fileprivate func updateUI(notificationsSnapshot snapshot: NotificationsController.NotificationsSnapshot) {
currentSnapshot = .init()
currentSnapshot.appendSections([.main])
currentSnapshot.appendItems(snapshot.notifications)
dataSource.apply(currentSnapshot, animatingDifferences: snapshot.animatesChanges)
if !snapshot.updatedNotifications.isEmpty {
DispatchQueue.main.async {
self.currentSnapshot.reloadItems(snapshot.updatedNotifications)
self.dataSource.apply(self.currentSnapshot, animatingDifferences: snapshot.animatesChanges)
}
}
}