[swift-users] Argument type 'Int' does not conform to expected type 'AnyObject'

Joe Groff jgroff at apple.com
Fri Sep 9 17:46:15 CDT 2016


> On Sep 9, 2016, at 2:02 PM, Kevin Nattinger via swift-users <swift-users at swift.org> wrote:
> 
> You’ll need to explicitly add the “as NSNumber” now.
> 
> https://github.com/apple/swift-evolution/blob/master/proposals/0072-eliminate-implicit-bridging-conversions.md

Or even better, you should now be able to use `Any` in Swift 3 in most places Swift 2 required `AnyObject`. Swift now handles the object conversion as part of the runtime Objective-C bridge, so these weird special-case implicit conversions should not be necessary in most cases anymore.

-Joe


More information about the swift-users mailing list