<div dir="ltr"><font face="arial, helvetica, sans-serif">Thanks,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><div dir="ltr" style="font-size:12.800000190734863px"><font face="arial, helvetica, sans-serif">var toExcludeOrCopy : AnyObject?</font></div><div dir="ltr" style="font-size:12.800000190734863px"><font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:12.800000190734863px"><font face="arial, helvetica, sans-serif">Could help me on some cases...</font></div><div style="font-size:12.800000190734863px"><font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:12.800000190734863px"><font face="arial, helvetica, sans-serif">But if I try this:</font></div><div dir="ltr" style="font-size:12.800000190734863px"><font face="arial, helvetica, sans-serif"><br></font></div><div dir="ltr"><div dir="ltr"><span style="font-size:12.800000190734863px"><font face="monospace, monospace">var props = [AnyObject]()</font></span></div><div><div><span style="font-size:12.800000190734863px"><font face="monospace, monospace">props += contact.phoneNumbers</font></span></div><div><br></div><div><span style="font-size:12.800000190734863px"><font face="arial, helvetica, sans-serif">( "</font><font face="monospace, monospace">contact</font><font face="arial, helvetica, sans-serif">" is as </font><font face="monospace, monospace">CNContact</font><font face="arial, helvetica, sans-serif">, so "</font><font face="monospace, monospace">contact.phoneNumbers</font><font face="arial, helvetica, sans-serif">" is </font><font face="monospace, monospace">[CNLabeledValue<CNPhoneNumber>] )</font></span></div><div style="font-size:12.800000190734863px"><font face="arial, helvetica, sans-serif"><br></font></div></div><div style="font-size:12.800000190734863px"><font face="arial, helvetica, sans-serif">I get this error:</font></div><div style="font-size:12.800000190734863px">/Users/laullon/xcode/bipo/BiPo/MergePreview.swift:82:21: Cannot convert value of type '[AnyObject]' to expected argument type 'inout _'<br></div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">With:</div><div><div><span style="font-size:12.800000190734863px"><font face="monospace, monospace">props.append(contentsOf: contact.phoneNumbers)</font></span></div><div style="font-size:12.800000190734863px"><br></div></div><div style="font-size:12.800000190734863px">I get this error:</div><div><font face="monospace, monospace"><span style="font-size:12.800000190734863px">/Users/laullon/xcode/bipo/BiPo/MergePreview.swift:83:33: Extraneous argument label 'contentsOf:' in call</span><br></font></div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">Any Idea?</div><div style="font-size:12.800000190734863px"><br></div></div></div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><font face="arial, helvetica, sans-serif">Germán Laullón<br><br></font></div></div></div></div></div></div>
<font face="arial, helvetica, sans-serif"><br></font><div class="gmail_quote"><font face="arial, helvetica, sans-serif">On Tue, Jan 10, 2017 at 12:36 AM, Hooman Mehr <span dir="ltr"><<a href="mailto:hooman@mac.com" target="_blank">hooman@mac.com</a>></span> wrote:<br></font><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"><font face="arial, helvetica, sans-serif">Ouch!</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">This is a side effect of ObjC lightweight generics being imported as Swift generics in Swift 3.0.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Since there is no common superclass that satisfies NSCopying & NSSecureCoding and the fact that NSSecureCoding has static requirements means you can’t do it (at least without hacks such as extending NSObject to conform to both protocols or creating a wrapper class and creating a non-generic subclass of CNLabeledValue and using it instead).</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">For now, you have to use <br></font><div><div dir="ltr"><div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">var toExcludeOrCopy : AnyObject?</font></div></div></div></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">This is worthy of a bug report and points to a serious issue: The “limitations” that result from importing ObjC lightweight generics as Swift generics. One possible solution can be implementation of “<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170102/029919.html" target="_blank">Enhanced Existentials</a>”.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font><div><blockquote type="cite"><div><div class="gmail-h5"><div><font face="arial, helvetica, sans-serif">On Jan 9, 2017, at 11:23 AM, German Laullon via swift-users <<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>> wrote:</font></div><font face="arial, helvetica, sans-serif"><br class="gmail-m_-3125263288773896551Apple-interchange-newline"></font></div></div><div><div><div class="gmail-h5"><div dir="ltr"><font face="arial, helvetica, sans-serif">Hi All</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I just upgrade to Swift 3. After open and convert my codes I found lots of errors. One of them is about CNLabeledValue.</font><div><font face="arial, helvetica, sans-serif"> </font></div><div><font face="arial, helvetica, sans-serif">With Swift 2.3, it works well with:</font></div><div><font face="arial, helvetica, sans-serif"> </font></div><div><font face="arial, helvetica, sans-serif">var toExcludeOrCopy : CNLabeledValue? </font></div><div><font face="arial, helvetica, sans-serif"> </font></div><div><font face="arial, helvetica, sans-serif">With Swift 3, it gives me the error message:</font></div><div><font face="arial, helvetica, sans-serif">Reference to generic type 'CNLabeledValue' requires arguments in <...>.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">After I fixed it with XCode, it changed to:</font></div><div><font face="arial, helvetica, sans-serif"> var toExcludeOrCopy : CNLabeledValue<AnyObject>? </font></div><div><font face="arial, helvetica, sans-serif"> </font></div><div><font face="arial, helvetica, sans-serif">However, Xcode gives me error message with this fix:</font></div><div><font face="arial, helvetica, sans-serif">Type 'AnyObject' does not conform to protocol 'NSCopying'.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I know the error is because of the generic type but I don't know how to declare with CNLabeledValue. My purpose is to store any the CNLabeledValue including phone number, email, address etc to one var.</font></div><div><font face="arial, helvetica, sans-serif">Any help will be appreciate.</font></div><div><div class="gmail-m_-3125263288773896551gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Germán Laullón<br><br></font></div></div></div></div></div></div>
</div></div></div></div><font face="arial, helvetica, sans-serif">
______________________________<wbr>_________________<br>swift-users mailing list<br><a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br></font></div></blockquote></div><font face="arial, helvetica, sans-serif"><br></font></div></div></div></blockquote></div><br></div></div>