Is it possible to use an Enum as a property for my model? I currently have a class like this:
class Checkin: RLMObject {
dynamic var id: Int = 0
dynamic
Since Realm support Objective-C enums and they are representable by Int you can use this:
class Checkin: Object {
dynamic var id: Int = 0
dynamic var kind: Kind = .checkedIn
@objc enum Kind: Int {
case checkedIn
case enRoute
case droppedOff
}
....
}
If you need to parse to/from String you can use a custom initializer for Kind and an toString function.
There is a discussion about this in GitHub
This works with Swift 3.0 and Realm 2.0.2