In the code below a receive an error "A stored property cannot be named 'description'" . If I change the property "description" to "description1" the error is gone. I'am using Xcode 15b8. Anyone having the same problem
import Foundation
import SwiftData
@Model class Category {
var name: String
var description: String
init(name: String, description: String) {
self.name = name
self.description = description
}
}
You can't name a Core Data attribute description
because it conflicts with a method in the NSObject
class. Currently SwiftData uses Core Data under the hood so the limitation also applies in SwiftData. See the following Stack Overflow question for more details:
Name your attribute something other than description
.