Sharing state among multiple iOS realm-enabled apps


#1

Hi,
We have serveral corporate apps all in the need to share data with each other. Using realm with an app group folder works perfect for this.

We now want to use backend synchronisation with this and I made a test app that works just fine. However, since we want to use the fact that any of these apps can be in the foreground, I would like all of them syncing data to the backend and not replicate the shared database into each apps sandbox.

Questions (sorry if they are newbie question):

  1. can I specify the location of a local offline database in combination with a fully synced realm instance? I tried to specify the file location and the server url at once in the config object but it did not work.

  2. in case the above works, what would happen if that offline database is updated from multiple realm instances in multiple apps?

/Andreas


#2

@pardeike Is this in the context of using realm-sync? If you want to use separate realms for non-synced Realm and synced realm that is fine - you just open two different realms with two separate configurations. You’ll want to leverage the built-in conflict resolution of realm-sync to deal with your second question.