[swift-users] Bug? Bad behaviour?

Adrian Zubarev adrian.zubarev at devandartist.com
Fri Dec 2 12:36:50 CST 2016

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161202/227ca803/attachment.html>

More information about the swift-users mailing list