[swift-users] Bug? Bad behaviour?
Zhao Xin
owenzx at gmail.com
Fri Dec 2 12:44:54 CST 2016
Implicit converting to `Any` or `AnyObject` is not allowed in Swift 3. You
have to do `as Any` or `as AnyObject` or as you did, `as NSNumber) yourself.
I suggest you read the change log. It really helps a lot.
Zhaoxin
On Sat, Dec 3, 2016 at 2:36 AM, Adrian Zubarev via swift-users <
swift-users at swift.org> wrote:
> Can you provide more details like what type all of these instances have.
> It’s hard to follow what exactly you’re doing there.
>
>
>
> --
> Adrian Zubarev
> Sent with Airmail
>
> Am 2. Dezember 2016 um 19:28:20, Maury Markowitz via swift-users (
> swift-users at swift.org) schrieb:
>
> Check out this line of code:
>
> if parts[2].characters.count > 0 { data["I3"] = Int(parts[2]) }
>
> This worked fine in 2.x, but in 3.0 it complains:
>
> Cannot subscript a value of type 'inout [String]' (aka 'inout
> Array<String>')
>
> It took me a *long* time before I consider that the error was incorrect
> and found this trivial solution:
>
> if c > 0 && parts[0].characters.count > 0 { data["I1"] = Int(parts[0]) as
> NSNumber? }
>
> So, is this a "bug"? The error has nothing to do with indexing, it seems.
> But maybe I'm wrong?
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161203/690e7707/attachment.html>
More information about the swift-users
mailing list