[swift-evolution] [Proposal] Make optional protocol methods first class citizens

Andrey Tarantsov andrey at tarantsov.com
Sun Apr 3 12:28:33 CDT 2016


> I do not understand why an optional method should require a default value. That’s not how optional methods work in Objective-C where the caller will ask whether the method is implemented and calls it or does something else. With a default value it would be much more difficult to do something different if the method is not implemented.

Yes, and that's the best part. The way Obj-C optional methods currently work, they are very hard to wrap/proxy/etc. Swift has a lot more expressive power, so I'm sure that you can adjust the return value to express the “I don't care” case without making the absence of the method magical.

A.



More information about the swift-evolution mailing list