<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Gonzalo,<div class=""><br class=""></div><div class="">While not a complete solution for the issues around bridging, the work on id-as-Any that I mentioned below was meant to help address these platform differences.</div><div class=""><br class=""></div><div class="">For example, let’s say you had a Foundation API that looked like this in ObjC:</div><div class=""><br class=""></div><div class="">- (void)foo:(id)x;</div><div class=""><br class=""></div><div class="">and imported like this into Swift:</div><div class=""><br class=""></div><div class="">func foo(_ x : AnyObject)</div><div class=""><br class=""></div><div class="">On Linux, attempting to call this:</div><div class=""><br class=""></div><div class="">bar.foo(“hello”)</div><div class=""><br class=""></div><div class="">would result in an error, because String is not an object type. On Darwin, String was implicitly bridged to NSString here for you.</div><div class=""><br class=""></div><div class="">Now (hopefully — I’m still working on verifying this), the above is imported like this:</div><div class=""><br class=""></div><div class="">func foo(_ x : Any)</div><div class=""><br class=""></div><div class="">which means that on Linux, this should actually work:</div><div class=""><br class=""></div><div class="">bar.foo(“hello”)</div><div class=""><br class=""></div><div class="">because String is indeed an Any. No need to do something like “hello”.bridge().</div><div class=""><br class=""></div><div class="">AnyHashable also helps. because we should be able to express API which takes untyped dictionaries with AnyHashable keys instead of NSObject keys.</div><div class=""><br class=""></div><div class="">Most of this stuff has only landed in the last week or two, so if you can give it a try and let us know how well it works out, that would be great.</div><div class=""><br class=""></div><div class="">- Tony</div><div class=""><br class=""></div><div class=""><div class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0116-id-as-any.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0116-id-as-any.md</a></div><div class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0131-anyhashable.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0131-anyhashable.md</a></div><div class=""><br class=""></div></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Jul 29, 2016, at 11:06 AM, Gonzalo Larralde <<a href="mailto:gonzalolarralde@gmail.com" class="">gonzalolarralde@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi everyone,<div class=""><br class=""></div><div class="">Wanted to know if there's any plan to find a solution for Auto Bridging between corelibs-foundation <> Swift types in the same manner as it is done for Obj-C.</div><div class=""><br class=""></div><div class="">There has been some discussions about this in the following PRs:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/apple/swift-corelibs-foundation/pull/310" class="">https://github.com/apple/swift-corelibs-foundation/pull/310</a><br class=""></div><div class=""><a href="https://github.com/apple/swift-corelibs-foundation/pull/303" class="">https://github.com/apple/swift-corelibs-foundation/pull/303</a><br class=""></div><div class=""><a href="https://github.com/apple/swift/pull/1994" class="">https://github.com/apple/swift/pull/1994</a><br class=""></div><div class=""><br class=""></div><div class="">The inclusion of this feature will allow more non-UIKit related packages to be used with almost no changes. </div><div class=""><br class=""></div><div class="">For what I understand the main blocker here is getting this to pass through Swift review (probably a more generic version of it, like _BridgeableType instead of _ObjectiveCBridgeable would help?), but wanted to understand first if this is a priority for the foundation team, and there is something that can be done to push for this feature.</div><div class=""><br class=""></div><div class="">Thanks!</div></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature" data-smartmail="gmail_signature"><br class="">--<br class="">Slds,<br class=""><br class="">Gonzalo.</div></div>
<br class=""><div class="gmail_quote">On Thu, Jul 28, 2016 at 6:22 PM, Matt Wright via swift-corelibs-dev <span dir="ltr" class=""><<a href="mailto:swift-corelibs-dev@swift.org" target="_blank" class="">swift-corelibs-dev@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class=""><div class=""><div style="direction:inherit" class="">The overlay changes were merged to corelibs libdispatch this morning. </div><br class="">Sent from my iPhone.</div><div class=""><div class="h5"><div class=""><br class="">On Jul 28, 2016, at 2:03 PM, Tony Parker via swift-corelibs-dev <<a href="mailto:swift-corelibs-dev@swift.org" target="_blank" class="">swift-corelibs-dev@swift.org</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class="">Hi Dave,<div class=""><br class=""></div><div class="">I don’t believe anyone is looking into this. If you want to do that, I think now would be the time!</div><div class=""><br class=""></div><div class="">- Tony</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 28, 2016, at 10:50 AM, David P Grove via swift-corelibs-dev <<a href="mailto:swift-corelibs-dev@swift.org" target="_blank" class="">swift-corelibs-dev@swift.org</a>> wrote:</div><br class=""><div class=""><div class=""><p class=""><tt class="">Tony Parker wrote on 07/28/2016 01:41:55 PM:</tt><br class=""><tt class="">> <br class="">> 1. Integrate swift-corelibs-dispatch into Foundation.</tt><br class=""><br class=""><tt class="">Hi Tony,</tt><br class=""><br class=""><tt class=""> Hopefully this is on the task list already, but if it isn't we should add it before it gets to be too late to change the compiler...</tt><br class=""><br class=""><tt class=""> When compiling a Swift program on Linux that imports Dispatch (or Foundation once the integration is done), the user has to give the extra compilation flags -Xcc -fblocks to enable block support.</tt><br class=""><br class=""><tt class=""> We really need to land a change somewhere so that either (1) blocks support is always on for Linux or (2) importing Dispatch or Foundation automatically turns on blocks support.</tt><br class=""><br class=""><tt class=""> I have some time today and tomorrow that I could use to work on this if no one is handling it already, but I'm not sure how best to tackle the problem. Suggestions?</tt><br class=""><br class=""><tt class="">--dave</tt><br class=""><br class="">
</p></div>
_______________________________________________<br class="">swift-corelibs-dev mailing list<br class=""><a href="mailto:swift-corelibs-dev@swift.org" target="_blank" class="">swift-corelibs-dev@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-corelibs-dev" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-corelibs-dev mailing list</span><br class=""><span class=""><a href="mailto:swift-corelibs-dev@swift.org" target="_blank" class="">swift-corelibs-dev@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-corelibs-dev" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev</a></span><br class=""></div></blockquote></div></div></div><br class="">_______________________________________________<br class="">
swift-corelibs-dev mailing list<br class="">
<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-corelibs-dev" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></body></html>