class Person {
// 属性监听器: 选择其中一个即可监听属性的改变
var name: String = "" {
// 即将改变
willSet {
print("即将改变")
}
// 发生改变
didSet {
print("已经改变")
}
}
}
let p = Person()
p.name = "jack"