optional protocols

I'm kind of dissapointed with the lack of optional protocols for native Swift types still in 2.0. I am happy to see the workaround of declaring default implementations through protocol extensions, but this seems like a workaround rather then a solution. The language natively supports optional protocols, except they have to be delared with the @objc keyword, which rules out using classes/structs/enums that I define in in the function declaration. I tried using the @nonobjc keyword inside the protocol, but only ended up with a compiler error (which is what I was expecting anyway). I'm sure there is a valid reason not to implement them in the language, I just don't know what it is, and can't for the life of me figure it out on my own. Especially as all the language support for working with them seems to be in place.


Andrew


PS, In case you're wondering, yes I filed a bug report on this a long time ago.

I consider the feature you're asking for to be a bug. You have an interesting opinion.

optional protocols
 
 
Q