1

我想在 CoreData 字段中实现不同的可能值作为 Transformable 和子类。Swift 似乎不喜欢我的实现:(超类)

public class ResponseItemValueDTODB: NSObject, NSSecureCoding {
  public static let supportsSecureCoding: Bool = true
  ...
}

子类:

class ResponseItemValueTextDTODB: ResponseItemValueDTODB {
  //public static var supportsSecureCoding: Bool  = true
  ...
}

现在错误:Class 'xx.ResponseItemValueTextDTODB' has a superclass that supports secure coding, but 'xx.ResponseItemValueTextDTODB' overrides -initWithCoder: and does not override +supportsSecureCoding. The class must implement +supportsSecureCoding and return YES to verify that its implementation of -initWithCoder: is secure coding compliant.

如果我取消注释子类中的行,快速编译器也不喜欢它,错误:Cannot override with a stored property 'supportsSecureCoding'在那一行

我应该如何让 NSSecureCoding 开心?

4

0 回答 0