First, let me say I am actually still on the swift book not the iOS programming book but I bought the iOS book just for this chapter for a project I’m working on. So please keep in mind I’m a little behind you all in my skills.
I have a class called DreamSign that has two properties: name and dreaminess. dreaminess is of type Dreaminess which is an enum. I’m not sure how to go about encoding it with NSCoding, I’m just getting errors up the wazoo when I add any encoding code so I’m just going to post it without it.
class DreamSign {
var name = "Default Dream Sign"
var dreaminess = Dreaminess.neutral
enum Dreaminess: Int {
case neutral = 9
case somewhatLikely = 30
case likely = 50
case veryLikely = 90
case definetly = 99
}
init(name: String, dreaminess: Dreaminess){
self.name = name
self.dreaminess = dreaminess
}
}