<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 seems like unexpected behavior and if the user intended it to return a value, it should be moved to the return line. The compiler is smart enough to warn about it and the warning goes away when you move the line up. If there is an issue where they need something that spans multiple lines putting it parenthesis would allow that.<div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">@IBAction</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> makeRed() {</div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span>return</div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">self</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span>view<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span>backgroundColor<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> = </span>UIColor<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">redColor</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">()</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></p><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 17, 2016, at 9:12 AM, Chris Wood &lt;<a href="mailto:chris@interealtime.com" class="">chris@interealtime.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Sorry, that was a terrible example which doesn’t work (typing code into an email at this point in the afternoon isn’t a good idea it seems!)</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I made a simple example project to show the issue. Two methods in the view controller, different behaviour depending on the trailing semicolon:</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://interealtime.com/misc/Semicolon.zip" class="">http://interealtime.com/misc/Semicolon.zip</a><br class=""></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">This scenario would be ‘wrong’ in general code, but is pretty common during debugging - and that trailing semicolon is actually necessary in this case (I hit this for real yesterday).</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div class="unibox-signature" style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="color: rgb(54, 61, 76);" class="">Chris</span></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><blockquote type="cite" class="unibox-hidden" style="margin: 0px; padding: 0px 0px 0px 12px; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(170, 170, 170); color: rgb(170, 170, 170); font-family: -apple-system, Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">On Mar 17, 2016, at 3:44 PM, Chris Wood &lt;<a href="mailto:chris@interealtime.com" class="">chris@interealtime.com</a>&gt; wrote:</div><div class=""><br class=""></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">Paul</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class=""><br class=""></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">The semicolon is actually needed still to avoid accidental multi-line statements. E.g. these functions behave differently:</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class=""><br class=""></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">func doNothing1() {</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>break</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>print(“This text gets printed”)</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">}</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">func doNothing2() {</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>break;</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>print(“This text isn’t printed”)</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">}</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class=""><br class=""></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class="">Until odd cases like this can be avoided, I think semicolons are still (though very rarely) necessary.</div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class=""><br class=""></div><div class="unibox-signature" style="font-family: -apple-system, Helvetica, Arial, sans-serif;"><span style="color: rgb(54, 61, 76);" class="">Chris</span></div><div class="unibox-signature" style="font-family: -apple-system, Helvetica, Arial, sans-serif;"><span style="color: rgb(54, 61, 76);" class=""><br class=""></span></div><div style="font-family: -apple-system, Helvetica, Arial, sans-serif;" class=""><br class=""></div><blockquote type="cite" class="" style="margin: 0px; padding: 0px 0px 0px 12px; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(170, 170, 170); color: rgb(170, 170, 170); font-family: -apple-system, Helvetica, Arial, sans-serif;"><div class="">On Mar 17, 2016, at 3:25 PM, Paul Ossenbruggen &lt;<a href="mailto:possen@gmail.com" class="">possen@gmail.com</a>&gt; wrote:</div><div class=""><br class=""></div><div style="font-family: -webkit-standard;" class="">+1 I think that let people do whatever they want if i makes them happy when it makes the code less readable is not a good idea. I support the notion that semicolon should not be allowed at end of line. It does nothing to help readability of the code. If it does nothing, it should go. Swift code should be easy to read, and in this case clarity wins. We have to break the semicolon habit :-)<span class="Apple-converted-space">&nbsp;</span></div><div style="font-family: -webkit-standard;" class=""><br class=""></div><div style="font-family: -webkit-standard;" class="">Perhaps providing a warning fix-it which removes them from the end of all lines in the file. I suspect most cases the only reason people put it there is habit or they are converting old code from another language.</div><div style="font-family: -webkit-standard;" class=""><br class=""></div><div style="font-family: -webkit-standard;" class="">- Paul</div></blockquote></blockquote></div></blockquote></div><br class=""></div></div></body></html>