这是我的密码
导入基础
导入CoreData

public class SpaceItem: NSManagedObject, Identifiable {
    @NSManaged public var name:String?
    @NSManaged public override var describe: String?
    @NSManaged public override var imagename: String?
 }

Xcode给出错误“Property不重写swift5中其超类的任何属性”
有人能帮我吗?

最佳答案

overridedescribe属性中删除关键字imagename,并满足Identifiableprotocol要求,

public class SpaceItem: NSManagedObject, Identifiable {
    var id: String

    @NSManaged public var name:String?
    @NSManaged public var describe: String?
    @NSManaged public var imagename: String?
}

10-07 21:53