Maybe the dictionary literal syntax could be used as a shorthand?

  

enum Suit: Int {  
  case Hearts, Spades, Diamonds, Clubs  
  
  var description: String {  
    return switch self [  
      .Hearts: "♥️",  
      .Spades: "♠️",  
      .Diamonds: "♦️",  
      .Clubs: "♣️"  
    ]  
  }  
  
  var isRed: Bool {  
    return switch self [  
      .Hearts: true,  
      .Diamonds: true,  
      .Spades: false,  
      .Clubs: false  
    ]  
  }  
}  

  

  

Patrick

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to