Post

Replies

Boosts

Views

Activity

Comment on modelContext.fetch() hits assert on release builds, but not on debug builds
Hi My question had nothing to do with the assert, I just wanted to understand the code better since the non-generic version worked and now I understand it better. I don't know if you are interested in testing this but I was thinking that maybe it's the associated type that causes the issues so one alternative to get would be to use MyModelProtocol instead for the generic type func addRecord<T: MyModelProtocol>(_ someDTO: T, recordName: String) async throws { ... }
Feb ’25
Comment on
When I tested this I didn't use model(for:) since I already had access to the object and then isDeleted was set to true after the deletion. This looks like an issue with SwiftData that. you might want to file a report about but as far as real world programming goes your example code looks quite contrived and I don't see why you would want to do something like this.
May ’25