[swift-users] Closure typing changed in Swift 3

Greg Parker gparker at apple.com
Mon Sep 12 15:55:28 CDT 2016

> On Sep 9, 2016, at 8:05 PM, Rick Mann via swift-users <swift-users at swift.org> wrote:
> I figured it out. The real problem is that .json accepts AnyObject, and the Dictionary is not AnyObject (not sure what this change is, since it worked in Swift 2). Anyway, that confused the type inference, which resulted in the red herring error message about the closure assignment.

What changed is Objective-C bridging. Previously the compiler could convert Dictionary to NSDictionary to AnyObject. Now that path is no longer implicitly available.

Greg Parker     gparker at apple.com <mailto:gparker at apple.com>     Runtime Wrangler

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160912/521a37a4/attachment.html>

More information about the swift-users mailing list