I found the following code in a project that compiles and runs successfully. But I can’t understand how this works. I tried using it on Google using various search phrases, but could not find an explanation.
let statusVal = "Somestring"
var status = (string: statusVal as NSString)
Can someone clarify what happens on the second line? According to the little knowledge I have in Swift, the second line should be something like
var status = NSString(string: statusVal as NSString)
which of course compiles.
source
share