My workaround was to change the super class into a protocol. This doesn't help avoiding redundant code in the subclasses, but it will enable you to use the Protocol in a similar way you might use a Super class in your code while still being able to take advantage of SwiftData.
This is not idea and hopefully will get fixed by Apple.
Post
Replies
Boosts
Views
Activity
Any luck figuring this one out? I have two almost identical situations in my app ... one works, the other doesn't ... and I can't seem to figure out why. They both get the ModelContext from the same environment so the error message doesn't make much sense.
What I find interesting is that the crash (for me) occurs not upon calling insert using the ModelContext, but in the constructor of the @Model (e.g. MyItem in your example). This is another surprise as I don't this the ModelContext is even used by the backingData.