Oddbean new post about | logout
 nostr:npub1p9kjc5uauqdfphar82xmq573tf3hnh3mcugkw3t6mjg2y76xkd3sum865w 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.