Running into this new issue in beta 3.
All of our immutable model attributes are now triggering swift compiler error from the title (tied to swift 6 - warning in swift 5).
Neither warning or error show up on previous builds.
Anyone else running into this? Hopefully not a limitation on swiftData that attributes must be mutable?
filed as: FB14379932 (new in Xcode 16 beta3: "cannot expand accessors on variable declared with 'let'" in SwiftData Models)
Yeah, this is a change introduced in beta 3. Every SwiftData attribute is converted (expanded) to a computed property with accessors via SwiftMacro, and since beta 3, the conversion requires the attribute be var
.
I think you can go ahead to apply the change to your SwiftData attributes. Doing that shouldn't have any negative impact.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.