<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
This can be done today with no syntax changes (you'd have to return
optional or handle the nil case though):<br>
<br>
var description: String? {<br>
return [<br>
.Hearts: "♥️",<br>
.Spades: "♠️",<br>
.Diamonds: "♦️",<br>
.Clubs: "♣️"<br>
][self]<br>
}<br>
<br>
<br>
<div class="moz-cite-prefix">On 3/23/2016 8:42 PM, Patrick Smith via
swift-evolution wrote:<br>
</div>
<blockquote cite="mid:9jiinvrv0eyb6x7yxnwnktcaf-0@mailer.nylas.com"
type="cite">
<div style="max-width: 100%; font-family: Nylas-Pro, Helvetica,
'Lucidia Grande', sans-serif; font-size: 14.5px; line-height:
21.75px;">Maybe the dictionary literal syntax could be used as a
shorthand?</div>
<div style="max-width: 100%; font-family: Nylas-Pro, Helvetica,
'Lucidia Grande', sans-serif; font-size: 14.5px; line-height:
21.75px;"><br>
</div>
<div style="max-width: 100%; font-family: Nylas-Pro, Helvetica,
'Lucidia Grande', sans-serif; font-size: 14.5px; line-height:
21.75px;">enum Suit: Int {<br>
case Hearts, Spades, Diamonds, Clubs<br>
<br>
var description: String {<br>
return switch self [<br>
.Hearts: "♥️",<br>
.Spades: "♠️",<br>
.Diamonds: "♦️",<br>
.Clubs: "♣️"<br>
]<br>
}<br>
<br>
var isRed: Bool {<br>
return switch self [<br>
.Hearts: true,<br>
.Diamonds: true,<br>
.Spades: false,<br>
.Clubs: false<br>
]<br>
}<br>
}<br>
</div>
<div style="max-width: 100%; font-family: Nylas-Pro, Helvetica,
'Lucidia Grande', sans-serif; font-size: 14.5px; line-height:
21.75px;"><br>
</div>
<div style="max-width: 100%; font-family: Nylas-Pro, Helvetica,
'Lucidia Grande', sans-serif; font-size: 14.5px; line-height:
21.75px;"><br>
</div>
<div style="max-width: 100%; font-family: Nylas-Pro, Helvetica,
'Lucidia Grande', sans-serif; font-size: 14.5px; line-height:
21.75px;">Patrick</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
swift-evolution mailing list
<a class="moz-txt-link-abbreviated" href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>
<a class="moz-txt-link-freetext" href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a>
</pre>
</blockquote>
<br>
</body>
</html>