-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
Swift adds great new features to enums.
However, it is not possible to directly persist enums to a Realm, because of the libraries use of the dynamic keyword (Obj-C only).
At the moment I am solving such issues like the following, but this should really be handled by the RLMObject behind the scenes.
Open for other suggestions ✨
enum State: String { case Open = "open" case Closed = "closed" } class Foo: RLMObject { dynamic var stateRaw = "" var state: State { get { if let a = State.fromRaw(stateRaw) { return a } return .Closed } } }