By itself, this would break switch statements, since they have to be exhaustive.

If anyone has any ideas about how to fix that, I'm all ears.

- Dave Sweeris

> On Jun 30, 2016, at 14:58, Edward Valentini via swift-evolution 
> <[email protected]> wrote:
> 
> 
> I am finding myself in a situation where the most elegant "swifty" solution 
> would be to allow enum extensions to add to existing case options.  For 
> example lets say I'm using a library that has the following enum defined: 
> 
> enum MyDirection {
>   case east, west
> }
> 
> My app for example also makes use of north and south, so I would love to be 
> able to write: 
> 
> extension MyDirection {
>   case north,south
> }
> 
> In objective c, one would probably have defined constants like 
> MyDirectionEast etc...  these would probably have been mapped to ints or 
> strings so a consumer of this library could have easily extended this to add 
> additional functionality, but using constants like that is not very "swifty"
> 
> I'm curious what the swift community thinks.
> 
> Thank you 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to