Oddbean new post about | logout
 @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. 
 @79546c83 Isn't that the same amount of boilerplate though?