Sync SQLite database between two iPhones

1k Views Asked by At

I'm currently finishing up a project for IOS in Swift in which I've used an SQLite database to store data with SQLite.swift.

At the time of coding I didn't know that SQLite files are stored locally on the device/simulator and I need a way to run the app and have the database synced between two devices, as soon as possible. I tried swapping over to Firebase since I heard that would be a solution but I'm not at all familiar with it and am worried it might be risky given all my functions are written for SQL tables. I also thought of keeping the SQL and adding on a firebase database to fetch the data from but I'm not sure how to execute that.

The solution doesn't have to be 100% reliable for all cases- I just need to simulate running the app on more than one device with synchronised data.

Does anyone have any suggestion for a way to do this? Or a way to store the data on a computer so that it can be accessed by both devices?

Any advice is appreciated!

2

There are 2 best solutions below

2
On

There are no elegant solution with pure SQLite database. Just few offers:

  1. Moving to CoreData (You will get all what you want with sharing data between devices)
  2. Uploading database file to iCloud from one device and download it from another device
  3. Build up classic client-server communication
0
On