<div dir="ltr">Why does it fizzle out? I've seen many posts on the web from developers looking for a way to return an array of all values from a Swift enum. The only decent solution I've seen work for enums that have Integer-type raw values, a la Nate Cook: <a href="http://stackoverflow.com/a/27094913/814861">http://stackoverflow.com/a/27094913/814861</a><div><br><div>What I always found interesting was how enums play with Switch statements. As Switch statements need to be exhaustive, they have the ability to check to see if all cases of the enum have been explicitly declared (or implicitly via the 'default' case). This makes me think that extending there should be a trivial way to add this functionality to enums.<br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Jan 17, 2016 at 7:07 AM Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> I propose adding a read-only ‘count’ property to enum types, that returns the number of cases; modelled on the API for arrays types.<br>
<br>
Most discussions of this start with a `count` proposal, proceed to an `allValues` array or something of the sort, and then fizzle out before anyone actually writes a formal proposal. Feel free to break that pattern.<br>
<br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div><div dir="ltr">-- <br></div><div dir="ltr">Best,<div><br></div><div>Arthur / Sabintsev.com</div></div>