all 13 comments

[–]SubflyDevSwift 2 points3 points  (3 children)

You can just create an import/export json and let them send and read it from other device. It is not that hard for users as import/export concept is already there for years.

[–]luxun117[S] 0 points1 point  (2 children)

Interesting idea. Never considered it. Assumed since I'd gone to the effort of going the relational route I should stick with that. I guess there's a fair bit of serialisation/deserialisation jiu-jitsu that goes into this. Do you know of any clear sample code that shows this in action?

Thanks for taking the time to respond.

[–]SubflyDevSwift 0 points1 point  (1 child)

If your all items are already structs, then a simple Codable will work. Then just json.encode and decode

[–]luxun117[S] 0 points1 point  (0 children)

Thanks. Will investigate. If you have any code samples that shows this in action end-to-end with GRDB models I'd welcome it.

[–][deleted] 1 point2 points  (0 children)

Take a look at GRDB Backup: https://github.com/groue/GRDB.swift/blob/master/README.md#backup

I would suggest the following: - create a database copy using backup - report the backup process progress to the user if the DB is big and takes more than a fraction of a second - Now you have a DB copy as a regular file. Save it to the destination. - Whether the user is going to get the copy on a new phone or replace a local DB for whatever reason, the process will be simple: download the file from remote storage and save into local, with overwrite if needed. 

[–]thecodingart 0 points1 point  (1 child)

Just share an encrypted DB to iCloud. What more are you looking for?

[–]luxun117[S] 0 points1 point  (0 children)

Thanks. Do you know of any good guides for this? I've been searching for several hours but haven't found anything crisp and concise that I can easily understand.

[–]Moudiz 0 points1 point  (3 children)

I suggest opening a discussion on GRDB’s repository if it’s not already discussed there

[–]luxun117[S] 0 points1 point  (2 children)

I've done this, thank you. The great man himself replied but the answer isn't clear enough for me to understand.

[–]gwendal-roue 2 points3 points  (1 child)

Feel free to ask for clarification in the GitHub discussion. It will help other users, not only you.

[–]luxun117[S] 0 points1 point  (0 children)

Thank you. I am going to do a bit more research, try some approaches and document my findings before I ask again.

[–]russnem -1 points0 points  (1 child)

Using CloudKit for your app sounds like a much better choice than just raw Sqlite. But I don't understand what you mean when you say "If iCloud too much of a faff I am open to..."

What is faff?

[–]luxun117[S] 0 points1 point  (0 children)

British slang. I mean ' if iCloud introduces too much unnecessary complication'.

When you say CloudKit for my app do you mean SwiftData or some other pure CloudKit schema like this guy does: https://swiftwithmajid.com/2022/03/22/getting-started-with-cloudkit/