photo of ben szymanski

Swift Sigh

Complaining about Swift.

let interpolatedText = "\(myNSDict?.valueForKey("Key1")! as! String) \(myNSDict?.valueForKey("Key2")! as! String)"

That's a mostly real snippet of code I just wrote in Swift.

"! as!"

... what does that even mean?

That's not concise, and to be honest looking at it makes me feel how I felt whenever I saw a ternary operator during my first year of CompSci. Just not practical.

Now, note that Xcode did this based on what it thought I needed, so there's a possibility that this is just Xcode making bad suggestions, but as it stands all I can think about is how Objective-C still an easier language to work with.

At some point, I hope that this gets cleaned up.