How to archive enum with an associated value?
I'm trying to encode an object and i have some troubles. It work's fine with strings, booleans and else, but i don't know how to use it for enum. I need to encode this: enum Creature: Equatable { enum UnicornColor { case yellow, pink, white } case unicorn(UnicornColor) case crusty case shark case dragon I'm using this code for encode: func saveFavCreature(creature: Dream.Creature) { let filename = NSHomeDirectory().appending("/Documents/favCreature.bin") NSKeyedArchiver.archiveRootObject(creature, toFile: filename) } func loadFavCreature() -> Dream.Creature { let filename = NSHomeDirectory()