<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-size: 14px;" class="">I’d like to hear thoughts on extending trailing closure syntax to avoid long inline closures. A significant benefit to adopting this sugar would be to clarify indentation style for long inline closures. I apologize if this has been brought up before, but I couldn’t find anything searching the list.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><font face=".SF NS Text" style="font-size: 14px;" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face=".SF NS Text" style="font-size: 14px;" class="">There is a lot of discussion about hacking around the issues with inline closures. Here are a few examples:</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face=".SF NS Text" style="font-size: 14px;" class=""><a href="https://www.natashatherobot.com/swift-trailing-closure-syntax/" class="">https://www.natashatherobot.com/swift-trailing-closure-syntax/</a></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face=".SF NS Text" style="font-size: 14px;" class=""><a href="https://owensd.io/2015/02/20/handling-multiple-closure-parameters/" class="">https://owensd.io/2015/02/20/handling-multiple-closure-parameters/</a></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face=".SF NS Text" style="font-size: 14px;" class=""><a href="https://bugs.swift.org/browse/SR-1199" class="">https://bugs.swift.org/browse/SR-1199</a></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face=".SF NS Text" style="font-size: 14px;" class=""><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160606/020470.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160606/020470.html</a></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face=".SF NS Text" style="font-size: 14px;" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font class=""><span style="font-size: 14px;" class="">I think a syntax similar to property accessors to allow multiple trailing closures could make these scenarios feel swifty. Property accessors already have a "get" specialization that is similar to the current trailing closures syntax, so in theory this could be a backwards compatible extension. </span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">func</span> <span style="text-decoration: underline" class="">f</span>oobar(a: <span style="color: #703daa" class="">Int</span>, b: <span style="color: #703daa" class="">Int</span>, completionBlock: ((<span style="color: #703daa" class="">Int</span>, <span style="color: #703daa" class="">Int</span>) -> <span style="color: #703daa" class="">Void</span>), failureBlock: ((<span style="color: #703daa" class="">Int</span>, <span style="color: #703daa" class="">Int</span>) -> <span style="color: #703daa" class="">Void</span>) <span style="text-decoration: underline" class="">{</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>// ...</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><p style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// Current syntax:</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">foobar(a: <span style="color: #272ad8" class="">1</span>, b: <span style="color: #272ad8" class="">2</span>,</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> completionBlock: { x, y <span style="color: #ba2da2" class="">in</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>// ...</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> },</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> failureBlock: { i, j <span style="color: #ba2da2" class="">in</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>// ...</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> })</div><p style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// A sugar similar to property accessors for multiple trailing closures:</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">foobar(a: <span style="color: #272ad8" class="">1</span>, b: <span style="color: #272ad8" class="">2</span>) {</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> completionBlock { x, y <span style="color: #ba2da2" class="">in</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>// ...</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> failureBlock { i, j <span style="color: #ba2da2" class="">in</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>// ...</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-size: 14px;" class="">Best,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-size: 14px;" class="">Eric</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div></body></html>