类型检查,我不能这样做,我认为应该工作以下类型检查:斯威夫特
var str:String?
//Compiler error: Downcast from 'String?' to 'String' only unwraps optional; did you mean to use '!'?
if str is String {
}
//Compiler error: is test is always true
if str! is String {
println("str is optional string")
}
我想说明使用is型检查。 – Boon 2014-09-01 20:21:25