<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 19, 2016 at 9:04 PM, Evan Maloney <span dir="ltr"><<a href="mailto:emaloney@gilt.com" target="_blank">emaloney@gilt.com</a>></span> wrote:</div><div class="gmail_quote"><div><br></div><div>... </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)">With this feature, the code above could be rewritten as:</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;background-color:rgb(247,247,247)">networkRequest<span style="color:rgb(167,29,93)">.</span>fetchData() { [<span style="color:rgb(167,29,93)">weak</span> <span style="color:rgb(167,29,93)">self</span>] result <span style="color:rgb(167,29,93)">in</span>
<span style="color:rgb(167,29,93)">guard</span> <span style="color:rgb(167,29,93)">let</span> <span style="color:rgb(167,29,93)">self</span> <span style="color:rgb(167,29,93)">=</span> <span style="color:rgb(167,29,93)">self</span> <span style="color:rgb(167,29,93)">else</span> { <span style="color:rgb(167,29,93)">return</span> }</pre></div></div></div></blockquote><div>If you're going to have boilerplate like that, then the following seems like it accomplishes the same thing [in this specific case] without changing anything:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px"><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;background-color:rgb(247,247,247)">networkRequest<span style="color:rgb(167,29,93)">.</span>fetchData() { [<span style="color:rgb(167,29,93)">unowned</span> <span style="color:rgb(167,29,93)">self</span>] result <span style="color:rgb(167,29,93)">in</span>
<span style="color:rgb(167,29,93)">guard</span> <span style="color:rgb(167,29,93)">self</span> !<span style="color:rgb(167,29,93)">=</span> <span style="color:rgb(167,29,93)">nil</span> <span style="color:rgb(167,29,93)">else</span> { <span style="color:rgb(167,29,93)">return</span> }</pre></div></div></blockquote></div><div> </div><div>Kurt</div></div>-- <br><div class="gmail_signature">kurt@CircleW.org<br><a href="http://www.CircleW.org/kurt/" target="_blank">http://www.CircleW.org/kurt/</a><br></div>
</div></div>