Live data from Hacker News

SwiftData

developer.apple.com

21–30 of 109 posts

Re: SwiftData

#21

It’d be interesting to see a performance comparison of SwiftData vs. (objc?) CoreData vs. plain XML for large datasets. I recall plain XMLs being faster than CoreData a few years ago in certain scenarios.

It is a good addition. CoreData, is ok, but is not really used from serous apps. At least, none of the large ones that I have worked on.

Either use flat files (serialized json) to save and restore state, or just Sqlite directly.

Re: SwiftData

#22
I built myself something similar on top of SQLite and Combine.

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?

Re: SwiftData

#23
post #22

I built myself something similar on top of SQLite and Combine. 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?

> Why wouldn’t Apple make these available downstream?

Because Apple cannot figure out that their deployment model is hamstringing adoption of their technologies.

Re: SwiftData

#24
One of the things I like about CoreData is that all the relationships and entities are defined in one file, and its easier to browse the history of that schema to see how the models evolved. One of the things I dislike though is that it doesn't interop well with swift types and almost everything has to be marked as optional. It looks like this SwiftData solves the second problem, but since definitions are spread across all the classes individually, it's harder to get a glance at the whole schema at once.

Re: SwiftData

#25
Sync really needs to be a feature of the web platform. A web app should be able to ask the user to sync its data accross devices. There's no reason you should have to worry about sync and authentication when you make an offline first web app.

Re: SwiftData

#26

It’d be interesting to see a performance comparison of SwiftData vs. (objc?) CoreData vs. plain XML for large datasets. I recall plain XMLs being faster than CoreData a few years ago in certain scenarios.

Isn't SwiftData mostly a wrapper around CoreData?

It just makes it easier to use - meaning less glue code. Making CoreData Swift + SwiftUI native approach. Where currently you'd have to make a Core Data class wrapped by a @Observable Class.

Re: SwiftData

#27

One of the things I like about CoreData is that all the relationships and entities are defined in one file, and its easier to browse the history of that schema to see how the models evolved. One of the things I dislike though is that it doesn't interop well with swift types and almost everything has to be marked as optional. It looks like this SwiftData solves the second problem, but since definitions are spread acro…

CMD+F @Model would largely address the issue of not having an overview of the schema.

Re: SwiftData

#28

One of the things I like about CoreData is that all the relationships and entities are defined in one file, and its easier to browse the history of that schema to see how the models evolved. One of the things I dislike though is that it doesn't interop well with swift types and almost everything has to be marked as optional. It looks like this SwiftData solves the second problem, but since definitions are spread acro…

put them in one file then.

Re: SwiftData

#29

I’m actually really looking forward to this. I tried building a few apps in 100% SwiftUI coming from React/Node.js and it was a pretty major pain. I also don’t know UIKit so I couldn't easily fallback.

I had the same experience as you. Using CoreData with SwiftUI feels strange. Unfortunately if we start using this now we can only target iOS 17+.
Post reply on HN