This should not be a keyword. Neither should it be part of the language.
Auto-completion (assuming you’re talking about that) is not a language feature.
It’s a feature of your editor/IDE. And thus it should be a default/setting 
therein if at all.

Similarly Xcode tends to auto-complete "() -> ()”-closures as { () -> Void in … 
}.
The “() -> Void in” not necessary in 99/100 cases. Still it shouldn’t have a 
language keyword.
Instead Xcode should be smart enough to omit the “… -> Void in” or at least the 
“ -> …”-part.
But again, this is a feature of your editor/IDE, not your language.

Thus I would recommend you to file a radar on it for Xcode to change its 
default auto-completion behavior. ;)

> On 04 Jan 2016, at 13:45, QQ Mail via swift-evolution 
> <[email protected]> wrote:
> 
> Hi, All: 
>       trailing closure is good for most cases, but sometimes it is also make 
> code unclear, for example: 
>       
> UIView.animateWithDuration(0.3, animations: { () -> Void in
>     // animation code here
>     }) { (Bool) -> Void in
>         // completion code here
> }
> 
> the label been removed and the code also not aligned well. 
> I would like to write like this: 
> 
> UIView.animateWithDuration(0.3,
>     
>     animations: { () -> Void in
>         // animation code here
>     },
>     completion: { Bool -> Void in
>         // completion code here
>     }
> )
> 
> It is possible, just every time you have to write it manually. It’s a little 
> wast.
> So I have a thought, since we already know this function is not well suit for 
> trailing 
> closure, can we add a attribute to disable it, for example: 
> 
> extension UIView {
> 
>     @disable_trailing_closure
>     public static func animateWithDuration(duration:NSTimeInterval, 
> animations:()->Void, completion:()->Void) {
>         // implementations ...
>     }
> }
> 
> I also found another one have issue for this too. link: 
> http://www.natashatherobot.com/swift-trailing-closure-syntax/ 
> <http://www.natashatherobot.com/swift-trailing-closure-syntax/>
> what do you think?
> 
> Best Regards
> 
> ChenYungui
> 
> _______________________________________________
> 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