Swift可选类型

var op:Int? = nil
op = 10
//强制解析可选类型
var jxValue = op!
if (op != nil) {
    print(op)
}
/*隐试解析可选类型 有两种状态 有值  没有值(nil)*/
//不需要手动对可选类型再次解包,通过隐试解包的方式就可以实现解包功能
var ysOp:Int! = 8
if (ysOp  != nil){
    print(ysOp)
}
原文地址:https://www.cnblogs.com/Mgs1991/p/5511523.html