Am I taking crazy pills? Directly out of the documentation:
“Swift automatically bridges between the String type and the NSString class. This means that
To go from String
to NSString
use the following constructor:
let swiftString:String = "I'm a string."
let objCString:NSString = NSString(string:swiftString)
With Xcode 7 (beta), using a downcast from String
to NSString
, as in below example, will result in a warning message, Cast from 'String?' to unrelated type 'NSString' always fails:
let objcString:NSString = swiftString as! NSString // results in error