Consider the Categories class below.
Without the @Model line, Xcode has no problems. As soon as the @Model line is added, Xcode protests that the class does not conform to Decodable or Encodable.
Apparently the @Model macro expanded macro prevents the implied boilerplate that the systems adds when the Codable protocol is added to the class.
I've filed feedback (FB12444837) for this. Does anyone have suggestions that will let me avoid the boilerplate? This is the simplest class in my schema, I've got 12 other classes with many more variables.
@Model
class Categories: Identifiable, Codable {
// MARK: Identifiable
var id: UUID { return uuidKey }
// MARK: - Properties
@Attribute(.unique) var uuidKey: UUID = UUID()
var dateCreated: Date = Date()
var dateModified: Date = Date()
var dateRealm: Date? = nil
var uuidUser: UUID = UUID()
var uuidFamily: UUID = UUID()
var myName: String = ""
}