I'm trying #swift and #swiftdata for the first time, and need help with an error.

I get: SwiftData/BackingData.swift:201: Fatal error: expected attribute to be Codable

while inserting this model into a context

@Model
final class Item {
var name: String
var kind: Kind

enum Kind: String, Codable {
case function
case module
}

init(name: String, kind: Kind) { ... }
}

Removing kind from the model fixes it.

Is this even my bug? Or a SwiftData issue?

@GregMorenz Release notes list issues with enum using String as the RawRepresentable type. If you changed it to Int it will start working. It’s a known issue so should hopefully be fixed soon.

@jonduenas Someone else mentioned this, but the exact same code with `Kind: String` replaced with `Kind: Int` results in the exact same error.

It's actually what I tried first.

@jonduenas Still, there were other people running into similar (though not identical) issues on the dev forums (also kindly linked by the other reply). So I'm just assuming that this will be fixed with that for now.
@GregMorenz Ah dang, definitely file feedback on it!