SecureCoding 与子类和 CoreData ni swift

问题描述

我想在 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.

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

我应该如何让 NSSecureCoding 开心?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)