If you do:
var x = "123" as NSString x.integerValue var x : NSString = "123" // or this as Sulthan suggests
he will not show this error.
I think your first example will automatically select that you want to use NSString, since NSString only has this .integerValue call.
The second example probably does not work, because he is not informed what it is, and instead they decide to use a fast line.
source share