<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><pre class=""><font face="Helvetica" class="">Rough proposal for implementing a method to get all cases on a enum. I feel like this is a valuable feature, and all current methods of doing this have major drawbacks. I'd like to field the idea to gauge interest.</font></pre><pre class=""><font face="Helvetica" class="">Thank You,
</font><span style="font-family: Helvetica; white-space: normal;" class="">Anthony Miller<br class=""></span><span style="font-family: Helvetica; white-space: normal;" class="">Lead iOS Developer, </span><a href="http://app-order.com/" class="" style="font-family: Helvetica; white-space: normal;">App-Order.com</a>
<span style="font-family: Helvetica; white-space: normal;" class="">Mobile: 702-334-8454</span></pre><pre class=""></pre></div></div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><pre class=""># Collection of all cases for an Enum
## Introduction</pre><pre class="">Add reflection capabilities for getting an `Array` or `Set` of all cases for an Enum. </pre><pre class="">This would not be supported for enums with associated values.</pre><pre class="">## Motivation<br class=""></pre><pre class="">This feature provides a benefit for many use cases. </pre><pre class="">Multiple methods of doing this exist currently, however each has obvious drawbacks.</pre><pre class="">For an summary of current methods, see: <a href="http://stackoverflow.com/questions/24007461/how-to-enumerate-an-enum-with-string-type/24137319#24137319" class="">http://stackoverflow.com/questions/24007461/how-to-enumerate-an-enum-with-string-type/24137319#24137319</a></pre><pre class="">## Proposed solution
<br class=""></pre><pre class=""><pre class="">This could be implemented as a static function or static constant. </pre><pre class=""> enum Foo {
case CaseOne, CaseTwo, CaseThree
}
let allCases: [Foo] = Foo.allCases() // [.CaseOne, .CaseTwo, .CaseThree] </pre><pre class=""><br class=""></pre><pre class="">Alternatively, an extension of `Mirror` to support mirrors of types could include this capability.</pre><pre class=""><br class=""></pre></pre></div></div></div><br class=""></body></html>