Re: [swift-evolution] [Idea] `enum` case count feature

2017-05-11 Thread Víctor Pimentel Rodríguez via swift-evolution
On Wed, May 10, 2017 at 8:52 PM, Saagar Jha via swift-evolution < swift-evolution@swift.org> wrote: > I use a enum (with a Int raw value) for sections in a table view, so > whenever the table view asks for the number of rows I pass in the number of > cases. Currently, I’m doing something like

Re: [swift-evolution] [Idea] `enum` case count feature

2017-05-10 Thread Saagar Jha via swift-evolution
Not Nicholas, but I thought I’d share one of my use cases. I use a enum (with a Int raw value) for sections in a table view, so whenever the table view asks for the number of rows I pass in the number of cases. Currently, I’m doing something like this: enum Sections: Int { case

Re: [swift-evolution] [Idea] `enum` case count feature

2017-05-10 Thread Brent Royal-Gordon via swift-evolution
> On May 10, 2017, at 12:58 AM, Nicholas Maccharoli via swift-evolution > wrote: > > Swift-Evolution, > > I'm sorry if this has been brought up before but is there a reason why there > is no built-in way of getting the number of cases an enum defines? > > Given

Re: [swift-evolution] [Idea] `enum` case count feature

2017-05-10 Thread Yuya Hirayama via swift-evolution
Hi, Nick. I have no idea about it and am interested in why you want to count the cases. --  Yuya Hirayama On 2017年5月10日 at 16:58:41, Nicholas Maccharoli via swift-evolution (swift-evolution@swift.org) wrote: Swift-Evolution,  I'm sorry if this has been brought up before but is there a reason

[swift-evolution] [Idea] `enum` case count feature

2017-05-10 Thread Nicholas Maccharoli via swift-evolution
Swift-Evolution, I'm sorry if this has been brought up before but is there a reason why there is no built-in way of getting the number of cases an enum defines? Given something like: enum MyEnum { case foo, bar, baz } It would be nice to get the number of cases this enum defines, something