<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">This should not be a keyword. Neither should it be part of the language.<div class="">Auto-completion (assuming you’re talking about that) is not a language feature.</div><div class="">It’s a feature of your editor/IDE. And thus it should be a default/setting therein if at all.</div><div class=""><br class=""></div><div class="">Similarly Xcode tends to auto-complete "() -&gt; ()”-closures as { () -&gt;&nbsp;Void&nbsp;in … }.</div><div class="">The “() -&gt; Void in” not necessary in 99/100 cases. Still it shouldn’t have a language keyword.</div><div class="">Instead Xcode should be smart enough to omit the “… -&gt; Void in” or at least the “ -&gt; …”-part.</div><div class="">But again, this is a feature of your editor/IDE, not your language.</div><div class=""><br class=""></div><div class="">Thus I would recommend you to file a radar on it for Xcode to change its default auto-completion behavior. ;)</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On 04 Jan 2016, at 13:45, QQ Mail via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=gb2312" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi, All:&nbsp;<div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>trailing closure is good for most cases, but sometimes it is also make code unclear, for example:&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">UIView</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">animateWithDuration</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0.3</span>, animations: { () -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Void</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">in</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="" class="">&nbsp; &nbsp; </span>// animation code here</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }) { (Bool) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Void</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">in</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span>// completion code here</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">the label been removed and the code also not aligned well.&nbsp;</div><div class="">I would like to write like this:&nbsp;</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(61, 29, 129);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">UIView</span><span style="" class="">.</span>animateWithDuration<span style="" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0.3</span><span style="" class="">,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; animations: { () -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Void</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">in</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span>// animation code here</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; },</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; completion: { Bool -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Void</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">in</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span>// completion code here</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">It is possible, just every time you have to write it manually. It’s a little wast.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">So I have a thought, since we already know this function is not well suit for trailing&nbsp;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">closure, can we add a attribute to disable it, for example:&nbsp;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><div style="margin: 0px; line-height: normal; color: rgb(187, 44, 162);" class="">extension<span style="" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">UIView</span><span style="" class=""> {</span></div><div style="margin: 0px; line-height: normal; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <font color="#ff2807" class="">@disable_trailing_closure</font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">&nbsp; &nbsp; public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">static</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> animateWithDuration(duration:<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">NSTimeInterval</span>, animations:()-&gt;<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Void</span>, completion:()-&gt;<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Void</span>) {</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span>// implementations ...</div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; line-height: normal;" class="">}</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">I also found another one have issue for this too. link:&nbsp;<a href="http://www.natashatherobot.com/swift-trailing-closure-syntax/" class="">http://www.natashatherobot.com/swift-trailing-closure-syntax/</a></div><div style="margin: 0px; line-height: normal;" class="">what do you think?</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">Best Regards</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">ChenYungui</div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=VbTStA9jyILqr7IzQe9KAt-2FaH8ZqpHcRullRxZjIJSabq6Vr4DakVqvoieTGrxJvP6CwOVmG1PUNh825i61DAwN7OWKAZ4y55MlcLQRL9W0J9cDzR6vbry4obHvizAMp6sQE2IhKYQR9dYGbxIMyF-2FdZi02twb8a2OBoFztu-2FhUkT36f6iRZey8yOzvqQ4aTm3XqwBwfYsuy-2BdzloSeF8uTaQo5vGgtIKQT84zL0Nv9e5ew2exKeUd6R1Oekdr1P" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>