简体   繁体   English

枚举未添加到领域类

[英]Enum not being added to Realm Class

I'm trying to add a Enum to my Person object however when i open the Realm Browser it does not appear in there and when i try to return it returns nil? 我试图向我的Person对象添加一个Enum ,但是当我打开Realm Browser时,它没有出现在其中,当我尝试返回时,它返回nil吗? Below you will see what i've tried. 在下面,您将看到我尝试过的内容。

Object 宾语

enum Type {
    case Cat(name: String, outDoor: Bool)
    case Dog(name: String, activityLevel: Int)
}

class Person:Object {
    var type: Type?
}

Realm does not support Swift enums (see the docs section on supported types for what is supported). Realm不支持Swift枚举(有关支持的类型 ,请参见文档部分的受支持类型 )。 There is no error for them like other unsupported types have because enum properties don't show up in the obj-c runtime's property list at all. 它们没有错误,就像其他不受支持的类型一样,因为enum属性根本不会显示在obj-c运行时的属性列表中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM