Re: enum as String

2016-01-11 Thread Eric E. Dolecki
Thanks for your reply. I’ve decided to change the enum as String to a simple enum and change the evaluation based on that enum - based on your reply. Since my method argument is typed to that enum, I can use shortcuts and no need for .rawValue. It’s all good now and is developer-friendly. Eric

Re: enum as String

2016-01-11 Thread Jens Alfke
> On Jan 11, 2016, at 7:37 AM, Eric E. Dolecki wrote: > > 1. How can I get rid of that .rawValue? It works but not coder-friendly. In Swift one usually uses a switch statement to match enums, rather than comparing rawValues. (There are a lot of examples in the book.) —Jens _

Re: enum as String

2016-01-11 Thread Alex Zavatone
I've got a few things set up in Objective-C for getting a string value from an enum but I'm sure it's different in Swift. I can send the Objective-C ones if you think they would be helpful. On Jan 11, 2016, at 10:37 AM, Eric E. Dolecki wrote: > I have the following enum > > *enum SomeMode: St

enum as String

2016-01-11 Thread Eric E. Dolecki
I have the following enum *enum SomeMode: String {* *case ComputeRequired* *case Calculating* *case Normal* *case ComputeUnavailable* *}* Works great if access like so: *SomeMode.Calculating.rawValue* 1. How can I get rid of that .rawValue? It works but not coder-friendly.