<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks, do you mind filing a bug at <a href="http://bugs.swift.org" class="">bugs.swift.org</a>?<div class=""><br class=""></div><div class="">Slava</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 19, 2017, at 4:18 PM, Edward Connell via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">In swift 3.1.1 I was able to have the function below, which "gets" an optional member collection of objects and calls their setModel member function. Simple and clean using the forEach method.</div><div class=""><br class=""></div><div class=""><span class="gmail-s2">public</span><span class="gmail-s1">&nbsp;</span><span class="gmail-s2">func</span><span class="gmail-s1">&nbsp;setModel(model:&nbsp;</span><span class="gmail-s3">Model</span><span class="gmail-s1">) {</span><br class=""><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""></blockquote><span class="gmail-s2"><span class="gmail-s3">&nbsp; &nbsp; get</span><span class="gmail-s1">()?.forEach { $0.setModel(<u class=""><font color="#ff0000" class="">model</font></u>: model) }</span></span><div class=""><div class="">}</div><span class="gmail-s2"><br class=""></span></div></div><div class=""><div class="">However it now fails with Swift 4.0 saying:&nbsp;<i class="">Extraneous argument label 'model:' in call</i></div></div><div class=""><br class=""></div><div class="">-------------------</div>If I rewrite the function as follows, then it compiles with no errors.<div class=""><br class=""><div class=""><span class="gmail-s2">public</span><span class="gmail-s1">&nbsp;</span><span class="gmail-s2">func</span><span class="gmail-s1">&nbsp;setModel(model:&nbsp;</span><span class="gmail-s3">Model</span><span class="gmail-s1">) {</span><br class=""><span class="gmail-s2">&nbsp; &nbsp; if</span><span class="gmail-s1">&nbsp;</span><span class="gmail-s2">let</span><span class="gmail-s1">&nbsp;items =&nbsp;</span><span class="gmail-s3">get</span><span class="gmail-s1">() {</span><br class=""><span class="gmail-s2">&nbsp; &nbsp; &nbsp; &nbsp; for</span><span class="gmail-s1">&nbsp;item&nbsp;</span><span class="gmail-s2">in</span><span class="gmail-s1">&nbsp;items {</span><br class=""><span class="gmail-s1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item.</span><span class="gmail-s3">setModel</span><span class="gmail-s1">(model: model)</span><br class="">&nbsp; &nbsp; &nbsp; &nbsp; }<br class="">&nbsp; &nbsp; }<br class=""><div class="">}<div class=""><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""></blockquote><div class=""><div class=""></div></div></div></div></div></div><div class=""><br class=""></div><div class="">Something is broken...</div><div class=""><br class=""></div><div class="">Any ideas what is wrong?</div><div class=""><br class=""></div><div class="">Thanks, Ed</div></div>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></div></body></html>