class
square {
varwidth:Int{
willSet{
println("width will set old=\(width) new=\(newValue)");
}
didSet{
("width did set new=width) old=oldValue)");
}
}
init(){
width=1;
}
}
vars:square=square();
@H_301_81@ s.width=2; 原文链接:https://www.f2er.com/swift/326944.html