Open mtgto opened 2 years ago
Any news on this ?
We really need the concrete Object that was deleted, changed
in RealmCollectionChange
and not only the indexes. Or maybe the _id
(primary key) of the object.
@mtgto Can you post your workaround? I'm pretty interested on it.
I have no workaround yet. Always reload data even if it does not need..
Are there any news regarding this issue?
Problem
RealmSwift provides RealmCollectionChange to listen a write transaction for realm collection. https://docs.mongodb.com/realm/sdk/swift/examples/react-to-changes/#register-a-collection-change-listener It makes enable partial update TableView and CollectionView easily.
Since iOS 13+, Apple releases NSDIffableDataSourceSnapshot to provide diff data for collection view and table view.
NSDIffableDataSourceSnapshot is different API from UITableView/UICollectionView to partial update. NSDIffableDataSourceSnapshot is based on
Identifier
which items are added/deleted/updated. (See Apple's API documentation and Sample application for details)However, RealmCollectionChange only give me which indexes are added or deleted or updated. I wanna identifier of item is deleted from callback of RealmCollectionChange, but there are only indexes. So I can't find which items are deleted.
Note: I can find which items are added/updated by indexes. I can access added/updated items referring realm collection via added/updated indexes.
Solution
It helps me Realm gives the way to retrieve which item or identifier of item are deleted from realm collection.
API usage image: (Not working now)
Only identifier is needed for deletions and modifications. Both Identifier and insertion position are needed for insertions.
How important is this improvement for you?
I'd like to see it, but have a workaround