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()
我思故我在