-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to save a swift array of enums? #13
Comments
that's a good question... I haven't tested it, but I think it's possible. |
It seems it is hard to support saving an array of enums for now.. enum Action: Int {
....
}
struct MyStruct: Realmable {
private var _actions: [Int] = []
var actions: [Action] {
get {
return _actions.compactMap({Action(rawValue: $0})
}
set {
_actions = newValue.map({$0.rawValue})
}
}
static func ignoredProperties() -> [String] {
return ["actions"]
}
} |
Thank you, that's exactly what I ended up doing. I hope it's supported in the future. |
Yes this is an important piece for me. I didn't realize this wasn't a feature and got pretty frustrated trying to sift through Realm errors being thrown |
@arturdev maybe, until it's implemented, we can add a disclaimer to the Readme with a link to this issue so people don't waste time trying to work it out? It could be a pretty cryptic error and not immediately obvious it's caused by Unrealm. |
@bryan1anderson @martinstoyanov Great news! ;) |
Love it, thanks so much!!! I am using Unrealm in all my new projects now :) |
Glad to hear that! |
I'm getting this error
my property actions is defined as this:
in a Realmable struct.
Action
is an enum that conforms to RealmableEnumAny ideas?
The text was updated successfully, but these errors were encountered: