Hi, I get this error Thread 1: Fatal error: Illegal attempt to use a nil as an Attribute - type + CustomType
when trying to use SwiftData on one of my main views, I wasn't seeing this error when I was working with other data types but some reason this started happening all of a sudden. Any clues as to what it might be?
SwiftData - Thread 1: Fatal error: Illegal attempt to use a nil as an Attribute
I digged a little more into the error, it looks like when I had an Enum type to the CustomType that I'm trying to use SwiftData doesn't like that? I still don't understand the error though.
I'm seeing this when I attempt to use a ClosedRange as the type of a model property.
Interesting, my enum error is fixed with Xcode 15 Beta 3, you should check if yours is fixed to.
SwiftData doesn't like enums at the moment, this video shows a workaround: https://www.youtube.com/watch?v=yOqGva62nzg
Basically, store the enum as a string, and compute the enum at runtime.
Is this bug reported? I'd consider it a showstopper.
Yep, I'm still seeing the issue with ClosedRanges on beta 5.