How can I store and read enum values in a NSDictionary in Swift.
I defined a few types
enum ActionType {
case Person
case Place
case Activity
}
Write enum to dictionary
myDictionary.addObject(["type":ActionType.Place])
"AnyObject does not have a member named key"
Read
var type:ActionType = myDictionary.objectForKey("type") as ActionType
"Type 'ActionType' does not conform to protocol 'AnyObject'"
I also tried wrapping the ActionType as NSNumber/Int which didn't quite work. Any advice on how to correctly store and read enum values in NSDictionaries?