【发布时间】:2017-12-07 00:51:02
【问题描述】:
在我的核心数据模型中,我有一个实体,它的属性是一个结构。这是结构
struct Range: NSCoding {
let minValue: Int
let maxValue: Int
/* implementations of
required init?(coder: NSCoder)
and
func encode(with aCoder: NSCoder)
*/
}
为简洁起见,让我们想象一个这样的实体:
Question
-title: String
-range: Range
我知道 range 属性需要是数据模型中的 Transformable。
当尝试将 Range 指定为可转换的类时,我收到 Property cannot be marked @NSManaged because its type cannot be represented in Objective-C 错误
什么是正确的设置?
更具体地说,Xcode 编辑器中以下属性的正确值是什么?
- 价值转换器
- 自定义类(我尝试将其设置为范围)
- 模块(当前设置为“当前模块”)
谢谢!
【问题讨论】: