Oops, yes, obviously I haven't played much with raw representable enums yet :) Thanks for the correction.
On Fri, Jul 17, 2015 at 3:39 PM, Quincey Morris < [email protected]> wrote: > On Jul 17, 2015, at 13:33 , Stephen J. Butler <[email protected]> > wrote: > > > How about using a Custom option with an associated String value? > > enum Foo:String { > > case Bar = “Bar" > case Etc = “Etc" > case Etc_Etc = “Etc Etc" > case Custom(String) > } > > > Unfortunately that won’t compile. One alternative is: > > enum Foo: String { > case Bar = "Bar" > case Etc = "Etc" > case Etc_Etc = "Etc Etc" > } > > enum FooPlus { > case AFoo (Foo) > case AString (String) > > var asString: String { > switch self > { > case let .AFoo (foo): return foo.rawValue > case let.AString (string): return string > } > } > } > > > > _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
