<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="">What error do you get (i.e. why doesn't it compile)?<div class=""><br class=""></div><div class="">Have you tried this?<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> result: [</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">AnyObject</span><span style="font-variant-ligatures: no-common-ligatures" class="">] = [</span></div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">"inputImage"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: [</span></div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">kCIAttributeIdentity</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,</span></div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">kCIAttributeClass</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: </span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"CIImage"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,</span></div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">kCIAttributeDisplayName</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: </span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"Image"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,</span></div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">kCIAttributeType</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: </span><span style="font-variant-ligatures: no-common-ligatures" class="">kCIAttributeTypeScalar</span></div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>]</span></div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">]</span></div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">return result</span></div><div class=""><br class=""></div><div class="">Charlie</div><div class="">
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On May 24, 2016, at 6:07 PM, simon gladman via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Apologies for arriving a little late to the party and I hope this is a suitable forum to discuss this subject. I've spent some time over the last few days moving a large Core Image project to Swift 3.0 and come across some side effects which I think are related to proposal SE-0072, <i class="">Fully eliminate implicit bridging conversions from Swift</i>.</div><div class=""><br class=""></div><div class="">First off, rightly or wrongly, I've always typed the scalar parameters of my subclassed <i class="">CIFilters</i> as <i class="">CGFloat</i>. It makes working with <i class="">CIVectors</i> and <i class="">CGRects</i> cleaner and feels more "Swifty" than using <i class="">NSNumber</i>. However, moving to Swift 3.0, using anything apart from an <i class="">NSNumber</i> breaks. For example:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color:rgb(4,51,255)" class="">let</span><span style="" class=""> radius: </span><span style="color:rgb(52,149,175)" class="">CGFloat</span><span style="" class=""> = 25</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(4,51,255)" class="">let</span><span style="" class=""> blur = </span><span style="color:rgb(52,149,175)" class="">CIFilter</span><span style="" class="">(</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: </span><span style="color:rgb(180,38,26)" class="">"CIGaussianBlur"</span><span style="" class="">,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; withInputParameters: [</span><span style="color:rgb(52,149,175)" class="">kCIInputRadiusKey</span><span style="" class="">: radius])</span></div></div><div class=""><br class=""></div><div class="">The same with passing arguments to a <i class="">CIKernel</i>, <i class="">CIWarpKernel</i> or <i class="">CIColorKernel</i>:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;kernel.</span><span style="color:rgb(52,149,175)" class="">apply</span><span style="" class="">(</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; withExtent:&nbsp;</span><span style="color:rgb(52,149,175)" class="">CGRect</span><span style="" class="">(x: 0, y: 0, width: 100, height: 100)</span>,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arguments: [radius])</span></div></div><div class=""><br class=""></div><div class="">Secondly, the attributes property of a filter (of type <i class="">[String: AnyObject]</i>) which I'd normally code along the lines of:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp;&nbsp;</span><span style="color:rgb(4,51,255)" class="">override</span><span style="" class="">&nbsp;</span><span style="color:rgb(4,51,255)" class="">var</span><span style="" class=""> attributes: [</span><span style="color:rgb(52,149,175)" class="">String</span><span style="" class=""> : </span><span style="color:rgb(52,149,175)" class="">AnyObject</span><span style="" class="">]</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(4,51,255)" class="">return</span><span style="" class=""> [</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(180,38,26)" class="">"inputImage"</span><span style="" class="">: [</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(52,149,175)" class="">kCIAttributeIdentity</span><span style="" class="">: 0,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(52,149,175)" class="">kCIAttributeClass</span><span style="" class="">: </span><span style="color:rgb(180,38,26)" class="">"CIImage"</span><span style="" class="">,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="" class="">kCIAttributeDisplayName</span><span style="" class="">: </span><span style="color:rgb(180,38,26)" class="">"Image"</span><span style="" class="">,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="" class="">kCIAttributeType</span><span style="" class="">: </span><span style="" class="">kCIAttributeTypeScalar</span><span style="" class="">]</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; ]</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; }</span></div></div><div class=""><br class=""></div><div class="">...fails to compile.&nbsp;<span style="font-family:Menlo;font-size:11px" class="">kCIAttributeTypeScalar&nbsp;</span>is of type <i class="">String</i> and needs to be cast to <i class="">NSString</i> and the dictionary itself needs to be cast to <i class="">AnyObject</i>:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp;&nbsp;</span><span style="color:rgb(4,51,255)" class="">override&nbsp;</span><span style="color:rgb(4,51,255)" class="">var</span> attributes: [<span style="color:rgb(52,149,175)" class="">String</span> : <span style="color:rgb(52,149,175)" class="">AnyObject</span>]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(4,51,255)" class="">return</span><span style="" class=""> [</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(180,38,26)" class="">"inputImage"</span><span style="" class="">: [</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(52,149,175)" class="">kCIAttributeIdentity</span><span style="" class="">: 0,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(52,149,175)" class="">kCIAttributeClass</span><span style="" class="">: </span><span style="color:rgb(180,38,26)" class="">"CIImage"</span><span style="" class="">,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="" class="">kCIAttributeDisplayName</span><span style="" class="">: </span><span style="color:rgb(180,38,26)" class="">"Image"</span><span style="" class="">,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="" class="">kCIAttributeType</span><span style="" class="">: </span><span style="" class="">kCIAttributeTypeScalar</span><span style="" class=""> </span><span style="color:rgb(4,51,255)" class="">as</span><span style="" class=""> </span><span style="" class="">NSString</span><span style="" class="">] </span><span style="color:rgb(4,51,255)" class="">as</span><span style="" class=""> </span><span style="" class="">AnyObject</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; ]</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">&nbsp; &nbsp; }</span></div></div><div class=""><br class=""></div><div class="">It seems awkward to me that the constant supplied by Core Image to describe an attribute's type needs to be cast to another type to get it working.&nbsp;</div><div class=""><br class=""></div><div class="">Are these changes just something that we'll need to live with? Are they still in flux? Have I totally misunderstood everything and there's a more elegant solution?</div><div class=""><br class=""></div><div class="">Any thoughts would be greatly appreciated!</div><div class=""><br class=""></div><div class="">Simon</div><div class=""><br class=""></div><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div style="text-align:center" class=""></div><div style="text-align:center" class=""><div style="text-align: start; word-wrap: break-word;" class="">Simon Gladman &nbsp; &nbsp;&nbsp;<a href="tel:%2B44%207973%20669691" value="+447973669691" style="color:rgb(17,85,204)" target="_blank" class="">+44 7973 669691</a></div><div style="text-align: start; word-wrap: break-word;" class=""><br class="">Blog:&nbsp;<a href="http://flexmonkey.blogspot.co.uk/" style="color:rgb(17,85,204)" target="_blank" class="">http://flexmonkey.blogspot.co.uk</a><br class="">GitHub:&nbsp;<a href="https://github.com/FlexMonkey" style="color:rgb(17,85,204)" target="_blank" class="">https://github.com/FlexMonkey</a></div><div style="text-align: start; word-wrap: break-word;" class="">Twitter:&nbsp;<a href="https://twitter.com/FlexMonkey" style="color:rgb(17,85,204)" target="_blank" class="">@FlexMonkey</a></div></div><br class=""></div></div></div></div></div>
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></body></html>