Peter Pik
Peter Pik

Reputation: 11193

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? 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?
}

Upvotes: 0

Views: 111

Answers (1)

Thomas Goyne
Thomas Goyne

Reputation: 8138

Realm does not support Swift enums (see the docs section on supported types for what is supported). 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.

Upvotes: 1

Related Questions