I recently encountered a "potential bug" with SwiftData.
I save my model with modelContent.insert and after that I get following error when trying to delete it with modelContent.delete:
Could not cast value of type 'Swift.Optional<Any>' (0x1f5b871f8) to 'Foundation.UUID'
This I mentioning the let id: UUID field marked with @Attribute(.unique)
.
This build doesn't crash running in an iOS Sim but if it's running thought TestFlight on my iPhone it just crashes.
If I try to delete elements that aren't just created, I don't get this error.