<div dir="ltr"><div>Enums are often used without associated values:</div><div><br></div><div> enum Attribute { case Title, Date }</div><div> enum Style { case Dark, Light }</div><div><br></div><div>In such cases, it's very useful to be able to iterate over all possible values. But you have to do it manually:</div><div><br></div><div> extension Attribute {</div><div> static var allValues: [Attribute] {</div><div> return [.Title, .Date] // imagine this x100, and not autogenerated :(</div><div> }</div><div> }</div><div><br></div><div>It would be nice if the compiler generated this for us. It doesn't have to be an Array, but any kind of SequenceType. Maybe something like "StaticCollection". Of course, this doesn't work in the general case, but I think simple enums are common enough that it might be worth doing.</div><div><br></div><div>Thoughts?</div><div><br></div><div><div class="gmail_signature"><div dir="ltr"><div>Jacob Bandes-Storch<br></div></div></div></div>
</div>