FYI, for anyone else ending up in this thread.
I was running into this issue periodically when accessing the @Environment modelContext.insert from my view's onAppear method.
Seems to me that there is probably a race condition in how the .modelContainer is setup for the view...
I moved my insert into a button clickhandler instead of the onAppear and the issue went away entirely.
Topic:
Programming Languages
SubTopic:
Swift
Tags: