Post

Replies

Boosts

Views

Activity

Comment on Bug? SwiftData + inheritance + optional many-to-one relationship
That's a real shame. Obviously inheritance is a key advantage of OOP. There have been few if any true object databases. Realm was looking good for a while, but Mongo bought them, then dropped support leaving all their users/customers out in the cold. I had great hopes for SwiftData's support for inheritance, but if you can only use it locally, not too useful after all.
Jan ’26
Comment on Bug? SwiftData + inheritance + optional many-to-one relationship
That's a real shame. Obviously inheritance is a key advantage of OOP. There have been few if any true object databases. Realm was looking good for a while, but Mongo bought them, then dropped support leaving all their users/customers out in the cold. I had great hopes for SwiftData's support for inheritance, but if you can only use it locally, not too useful after all.
Replies
Boosts
Views
Activity
Jan ’26
Comment on Bug? SwiftData + inheritance + optional many-to-one relationship
Yes, my architecture for an upcoming app uses inheritance with SwiftData, but I will need CloudKit, so this bug means I will need to figure out a different architecture, unless it's fixed soon.
Replies
Boosts
Views
Activity
Jan ’26
Comment on Best practice for centralizing SwiftData query logic and actions in an @Observable manager?
I have a class that is not part of the UI in which I use with SwiftData. For the fetch method, I pass in the model context and use modelContext.fetch(fetchDescriptor). I also pass in the modelContext to the save method and just use do/try/catch for the insert/update/save calls as I would in a View. It all works fine.
Replies
Boosts
Views
Activity
Jan ’26