[swift-evolution] [Proposal] Make optional protocol	methods	first class citizens
    Andrey Tarantsov 
    andrey at tarantsov.com
       
    Sun Apr  3 12:26:56 CDT 2016
    
    
  
> Some ideas I was thinking about for optional protocol functions was you’d declare it like this:
> 
> protocol UIGestureRecognizerDelegate {
>  optional func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool = true
> }
> 
> If you put “optional” there, the compiler would auto-generate an empty function in a protocol extension in your module as if you had specified one yourself. If the function has a return value, you would be required to specify the default return value in the protocol which provides automatic documentation of the default, too.
REALLY digging this. Strong +1.
A.
    
    
More information about the swift-evolution
mailing list