I’m building an iOS app and I’m interested in backing-up and synchronizing my local Realm database to my own server. I need to track insertions, deletions, and updates and mirror those on my server.
Collection Notifications seem like the place to build this integration, but I can’t figure out how to sync deletions because RLMResults objects are live. By the time the notification is triggered, the items that were deleted are already inaccessible, and the RLMCollectionChange object only contains the indices of the objects before they got deleted. It seems to me that to get a reference to the deleted objects themselves (at least their primaryKey), I have to keep my own, non-live version of the RLMResult and keep that in sync with the RLMResults as well, which seems like a totally incorrect approach.
I can see that I can add an Object Notification as well, and that will let me know when a specific RLMObject is deleted, but adding a notification for each and every object in my Realm also seems inefficient. Is that not the case?
I just started researching this and I’ve done my fair share of Googling to no avail. It’s entirely possible I missed something obvious about the solution.