Ask HN: Thoughts on SwiftData as a Framework?

mkchoi212Tuesday, February 13, 2024

1

0

I have been using SwiftData for about 3-4 months and it's been... interesting. I am confused about some of the decisions Apple made when building the framework. Particularly, why is dealing with multiple model contexts so difficult? Even with autosaving on, I found that deleting an object in a separate model context - one that isn't the main context - doesn't get reflected on the main context. In addition, I haven't been able to find a mechanism that guarantees all contexts are on the same page. If this is the case, are we supposed to be making all critical changes on the main context?

Also, what about ModelActors? If you can't pass the main context into a model actor, how can you use ModelActors and be confident that you are making changes based on a database state that has no pending changes?

Comments

0