<div dir="ltr">I'm not sure if this is truly different from the "Setup Closures" discussion. Wouldn't some of that proposed syntax achieve exactly the same goal?<div><br></div><div><div>someViewController.view.layer.{</div><div> shadowColor = UIColor.grayColor().CGColor,</div><div> shadowRadius = 5.0,</div><div> shadowOffset = CGSizeMake(0.0, 0.5),</div><div> shadowOpacity = 0.75</div><div>}</div></div><div><br></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div>Jacob Bandes-Storch<br></div></div></div></div>
<br><div class="gmail_quote">On Wed, Dec 16, 2015 at 3:27 AM, Jakob Egger via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><span><div>On 15 Dec 2015, at 22:48, Chuquimia, Max via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div></span><span><div><div dir="ltr"><div><p style="margin:1.2em 0px!important">What I propose is a natural way of assigning properties on <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline;background-color:rgb(248,248,248)">layer</code> with a syntax we are all already used to:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre-wrap;overflow:auto;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em;background-color:rgb(255,255,255);display:block!important;background-position:initial initial;background-repeat:initial initial">someViewController.view.layer = [
.shadowColor = <span style="color:rgb(92,38,153)">UIColor</span>.grayColor().<span style="color:rgb(92,38,153)">CGColor</span>,
.shadowRadius = <span style="color:rgb(28,0,207)">5.0</span>,
.shadowOffset = <span style="color:rgb(92,38,153)">CGSizeMake</span>(<span style="color:rgb(28,0,207)">0.0</span>, <span style="color:rgb(28,0,207)">0.5</span>),
.shadowOpacity = <span style="color:rgb(28,0,207)">0.75</span>
]
</code></pre></div></div></div></span></blockquote><br></div><div>You can already do something similar to this using blocks:<div><br><div>({</div><div><span style="white-space:pre-wrap">        </span>$0.shadowColor = UIColor.grayColor().CGColor</div><div><span style="white-space:pre-wrap">        </span>$0.shadowRadius = 5.0</div><div><span style="white-space:pre-wrap">        </span>$0.shadowOffset = CGSizeMake(0.0, 0.5)</div><div><span style="white-space:pre-wrap">        </span>$0.shadowOpacity = 0.75</div><div>})(someViewController.view.layer)</div></div><div><br></div><div>or using optional unwrapping:</div><div><br></div><div>if let layer = someViewController.view.layer as CGLayer? {</div><div><span style="white-space:pre-wrap">        </span>layer.shadowColor = UIColor.grayColor().CGColor</div><div><span style="white-space:pre-wrap">        </span>layer.shadowRadius = 5.0</div><div><span style="white-space:pre-wrap">        </span>layer.shadowOffset = CGSizeMake(0.0, 0.5)</div><div><span style="white-space:pre-wrap">        </span>layer.shadowOpacity = 0.75</div><div>}</div></div><br>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qxDJO1RQsXDhIr-2FWI7yOnyaIV5J87Iemj0J8zNGurfEG8t-2BBBRJH-2B0jJU-2Fr0dzgNW910rXH96FjasB3ezv3yZpcjdt1Sxi4lucVcoL18LWHRY-2Ff10G4QU-2BJAM21prdkSt8l8DXx5EwjZB-2BwWGZT-2FMo-2FhWhwhke8dH2zYZo-2F0RH8QsbUAfKCggsHYDqTndLx0b8-3D" alt="" width="1" height="1" border="0" style="min-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">
</div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>