I encountered another bug with SwiftData and inheritance and reported it (FB21837287). This one is not related to CloudKit. Briefly, SwiftData crashes during auto-save when the schema contains:
A base @Model class with at least one subclass (inheritance)
A separate @Model class with a reference to the base class
The crash occurs specifically when:
There is a class inheritance hierarchy (Beta: Alpha)
A separate class (Standalone) has a reference typed as the base class (Alpha?)
Changing the reference from var ref: Alpha? to var ref: Beta? (subclass) eliminates the crash.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: