Syncing Realm database with Cloudkit

Hey all,

If you have completed Chris’ excellent database course and would like to add iCloud syncing via Cloudkit, I found a great solution.

The downside I have found is with deleting objects. The framework author says that simply setting a new var isDeleted to true and the framework will clean things up.

What I found is that it does indeed take care of deleting data stored in iCloud, but not so much in the tableVIew, etc. It actually does clean up the delete when the app reloads (swipe it away) but can be confusing to the user wondering if the object was deleted or not.

My workaround was to set the var isDeleted , then call removeAll() from the label and then call append(“an explanation that the deletion happened”) on the same label.

Finally, my experience is with iOS 13.x . One of these days I may try it with a different version of iOS and see if the delete behavior is the same.

Happy coding.
Blessings,
—Mark

1 Like