[swift-evolution] Proposal: Enum 'count' functionality
bwhiteley at gmail.com
Tue Dec 22 11:10:10 CST 2015
On Mon, Dec 21, 2015 at 1:42 AM, Andyy Hope via swift-evolution <
swift-evolution at swift.org> wrote:
> Hi Swift Team and Community
> I’ve put a proposal up on GitHub to add a cases ‘count’ functionality to
> Enums for the Swift language
> Comments, feedback, scenario appends very much welcomed. Thank you
I would discourage adding just a `.count`. I've heard a few people ask for
this over the last year. In almost all cases it is due to people falling
back to the way they dealt with enums in Objective C when in fact there is
usually a better way in Swift. Adding `.count` would inhibit the discovery
of better ways of doing things.
However, I'm having a hard time arguing against `.cases`. In at least one
place I currently have an `.allCases` computed property on an enum.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution