Oddbean new post about | logout

Notes by orkoden | export

 @096d2c53 Instead of a struct, enum, and switch tray a protocol and implement it in several structs or classes. 
protocol IceCream {
     var displayRep: DisplayRep {get}
}
struct ChocolateIceCream: IceCream {
    let name = "choco"
    var displayRep: DisplayRep { return .init(title: name)}
}
You could also save all IceCream flavors in a plist or something.