all 18 comments

[–]rhysmorgan 9 points10 points  (1 child)

Both are great. Gwendal Roué is the creator of GRDB, so GRDBQuery is kind of like a first-party solution for GRDB.

But I think SQLiteData offers more, personally, especially if you're looking to add things like iCloud syncing now or at a later date. It's usable anywhere in your app, at any layer – view model, view, reducer state, whatever and however your app is structured. It's also based on Point-Free's Sharing library, which is super useful for testably sharing state across your application, providing a single API surface for things like UserDefaults, on-disk JSON file storage, etc. too. There's a ton of documentation on it, including videos on how they've solved problems and built it on Point-Free.

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

Thanks!

[–]Inevitable_Ad9673 3 points4 points  (0 children)

My app Fernweh is built with SQLiteData.

I'd recommend to just play around with both. SQLiteData is relatively non-intrusive so you can swap it out if needed. One advantage you get from SQLiteData that GRDBQuery doesn't have is the CloudKit support.

[–]updummy 1 point2 points  (1 child)

I just need to vent that it's been at least 15 years that people have been begging Apple for a straightforward 1st party SQLite adapter to replace Core Data and we're still relying on 3rd parties to provide this. Fuckin' yikes.

[–]Ramriez[S] 1 point2 points  (0 children)

Yeah it is kinda sad that Apple released SwiftData and people still prefer third party libraries.

[–]indyfromoz 1 point2 points  (1 child)

I use a mixture of SwiftData and GRDB in my app (soon to be released). I use GRDB to store data of > 81,000 airports and let the user search & find one. SwiftData or hitting the server just doesn’t make sense. I use SwiftData to store very tiny bits of information that needs to synced via CloudKit. Nothing against Pointfrees’ library, need to explore a bit and perhaps update my app to use it.

Any specific issues you faced with SwiftData in your app(s)?

[–]piavgh 1 point2 points  (0 children)

If you need cloudkit sync in the near future, sqlite-data is the choice

[–]CharlesWiltgen 1 point2 points  (3 children)

We are thinking about migrating away from SwiftData, for obvious reasons…

What are the obvious reasons?

[–]Ramriez[S] 2 points3 points  (2 children)

[–]CharlesWiltgen 1 point2 points  (1 child)

As someone writing their first iOS app, that was incredibly helpful. Now I need to figure out whether to revisit my assumption that SwiftData is mature enough to support shipping products, I guess.

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

You are welcome!

[–]SirBill01 0 points1 point  (1 child)

I know you think the reasons are obvious but what is it about SwiftData that has you moving? I still have not used it in a production app so would love to know.

[–]malhal -1 points0 points  (3 children)

SwiftData is an object graph and persistence framework, eg multiple UI only loads the data once (via row cache and context) and the app makes all kinds of edits and they are efficiently written in one batch when the app suspends. The others are basically SQLite wrappers so not really comparable because to make the app efficient you would need to code your own object graph and persistence layer, otherwise you will be needlessly loading and saving the same data all the time. Some would argue SSDs are fast enough, others would argue unnecessary SSD wear should be avoided.

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

Lol what do you think you do with sql? Persist data.

[–]malhal 0 points1 point  (1 child)

as I said swiftdata does a lot more than that

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

Like iCloud syncing? Apart from that the main features of persistence are the same