Search code examples
swiftrealmcloudkit

How to sync Realm data between iOS devices


I currently have an iOS app that uses Realm as its local database. Everything is working fine but what I would like to do is, be able to sync the data between iOS devices, I know I could use the Realm Cloud Platform services but right now I don't have enough revenue to justify the expenses for the service.

What are my free options to be able to sync the data between iOS devices?

Is CloudKit an option? If yes, would that play well with Realm or will I run into syncing issues etc.?


Solution

  • I'll preface this answer by stating that nothing is absolute so this is just some general points.

    Generally speaking, the databases don't 'work' with each other without integrating an additional API and writing the code to make that happen.

    Realm Cloud offers seamless integration so that's what I would suggest - with low volume the pricing shouldn't be too bad. Also, with the upcoming integration with MongoDB, it's going to provide quite a bit of flexibility.

    Firebase offers a free plan but it's a totally different kind of database (NoSQL) with a different API. That would require a massive re-write and total re-thinking of your data.

    CloudKit works with CoreData, which is again a different database (well, a framework to a variety of back end storage solutions) and API. CD is 'more like' Realm but again, will still require a pretty big re-write. CloudKit exposes a JS API so you may be able to leverage that if you want to integrate JS/Web app.