>>> (tl;dr: will Swift 3.0 improve iteration for enum values? Some kind of 
>>> .next() method for values or .all[] property. Currently we have a problem 
>>> with this.)
>> 
>> There are proposals to do this, but they're on hold at the moment because 
>> the guy who was the main driving force got busy with meatspace things. 
>> Roughly, you would be able to conform an enum to a ValuesEnumerable protocol 
>> which would automatically synthesize an `allValues` static property on it. 
>> You could use an extension to do this to an enum that didn't belong to you, 
>> so you could get this even if the original author didn't think to add it.
>> 
> 
> Could you provide a little more information about this ValuesEnumerable 
> protocol? My Swift says it doesn't know about such protocol.
> Strange, but goggle knows nothing about
> 'swift "ValuesEnumerable"'
> But I can see ValuesEnumerable in some articles related to C#.

This design is still very much under development—it hasn't even been reviewed, 
let alone added to the language. Here's the draft proposal: 
<https://github.com/jtbandes/swift-evolution/blob/case-enumerable/proposals/0000-derived-collection-of-enum-cases.md>

I'm not saying that this will necessarily be a solution that ends up being 
accepted—I'm merely saying that yes, it's something people are thinking about 
and designing; it's just been inactive for a few weeks.

-- 
Brent Royal-Gordon
Architechies

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

Reply via email to