swift直接赋值与引用赋值都会触发willSet
作者:互联网
class baseGoo{
var isScannerRunning = false
{
willSet{
print(newValue)
}
}
var desp:String = ""
{
willSet{
print(newValue)
}
}
func testFun()->(){
desp = "bgggg"
}
}
let base = baseGoo()
base.desp = "egggg"
base.testFun()
标签:testFun,willSet,desp,var,base,print,swift,赋值 来源: https://www.cnblogs.com/feng9exe/p/10430282.html