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

Roderick Mann rmann at latencyzero.com
Fri Sep 9 18:23:41 CDT 2016


> On Sep 9, 2016, at 15:46 , Joe Groff <jgroff at apple.com> wrote:
> 
> 
>> 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.

Thank you both for the answers.

In the end, I changed the method to take "Any" instead of "AnyObject", since it just passed it on to a system call that accepted "Any".


-- 
Rick Mann
rmann at latencyzero.com




More information about the swift-users mailing list