Honestly, we really need this for a lot of different cases:
> * Allow you to attach member definitions to particular cases. It would be an
> error if they didn't all define the same members, unless there was a
> top-level catchall.
>
> enum Suit: Int {
> var isRed: Bool { return false }
>
> case Hearts {
> let description: String { return "♥️" }
> let isRed: Bool { return true }
> }
> case Spades {
> let description: String { return "♠️" }
> }
> case Diamonds {
> let description: String { return "♦️" }
> let isRed: Bool { return true }
> }
> case Clubs {
> let description: String { return "♣️" }
> }
>
> static var all = [ Hearts, Spades, Diamonds, Clubs ]
> }
A.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution