I was all bought into RealmSwift, with iCloud syncing. Because I added a layer already that syncs Realm with iCloud, I expect transitioning to SwiftData (or from it to anything else) will work nearly out of box, without having to rip out the Realm code yet either. It'll receive the same iCloud data as Realm does.
I used SQLite a few years ago for a Swift/SwiftUI macOS app, and this looks like what I would have used if it was available. All in all, Apple is going in a good direction with Swift, SwiftUI, SwiftData, etc.
The more interesting addition to me looks to be CKSyncEngine, which would allow for easily adding a CloudKit sync engine to something like GRDB.
Defining models in structs and extending and conforming them to various protocols, using them in SwiftUI and passing them across threads feels much more natural to me.
Can I ask what experience you had with CoreData and SwiftUI? And what do you prefer now instead? Thank you.
Now I’m confused, should I abandon it and go with the first hand solution? I would actually prefer that but this requires the new versions of the Apple platforms. Why wouldn’t Apple make these available downstream?
Because it probably relies on new stuff that's only in the new version of the operating system. Otherwise, you'd have to back port a chunk of your new stuff to the older operating system, creating a lot more work for little gain.
And why do all of that when over 80% of the installed base will be running iOS 17 within 8 months, so what are you really gaining?
Because Apple cannot figure out that their deployment model is hamstringing adoption of their technologies.
[0] https://github.com/apple/swift-evolution/blob/main/proposals...
https://www.macrumors.com/2023/06/01/apple-shares-ios-16-ado...
80% of iPhones run the latest OS precisely because they are dead serious about long term support for devices.
I‘ve been an iOS dev since iOS 4, and have always been put off by this sneaky way of planned obsolescence. Older iOS releases do get security fixes, but only a tiny fraction of the fixes newer versions get. I don’t find this applaudable.
Now for new apps I can see going all in with the latest SDKs.
I think for both platforms, OS fragmentation depends heavily on your target audience, moreso than the platform stereotypes.
This is irrelevant, though, as the hottest Android framework (Jetpack Compose) is usable on devices released 9 years ago. This is the advantage of the way Google deploys major improvements vs Apple.
It tracks sprint workouts with GPS / pedometer. It's not Uber, but it's a good bit beyond a hello world.
I can imagine starting out with SwiftData @Model's, but then redefining the @Model macro to work with another backend -- even deploying the same models to different backends on different platforms (e.g., CoreData on iOS and MySQL on Linux).
"API-compatible" now includes attributes. This could be a great opportunity for alternatives to the CoreData stack.
Apple can sync over iCloud.
What are Firefox users going to sync over?
Compare to browser bookmarks. Not a "web feature".
I have been a bit spooked on Core Data, after a friend of mine had a months-long ordeal with it; finally giving up on it, and setting up his own file-based DB.
But I do have use cases for this kind of thing.
Either use flat files (serialized json) to save and restore state, or just Sqlite directly.
I still prefer Realm though. It has a much more flexible days model and I can use it both on iOS and Android with seamless sync between the two.
When Apple adds cross-platform sync to SwiftData I’ll consider it. Until then it is dead in the water.
SwiftData is the Swift version of Apple's CoreData, which is pretty much a database ORM.
It's a massive improvement on the old APIs that were written decades ago for Obj-C.
Swift Data is just a framework to annotate data structures to be stored by Core Data.
It looks a lot like an ORM.