Swift 中的 getter 和 setter 方法
2017-06-08 本文已影响37人
e5a8d3183387
class Person: NSObject {
private var _name: String?
var name: String? {
get {
return _name;
}
set {
_name = newValue
}
}
}
class Person: NSObject {
private var _name: String?
var name: String? {
get {
return _name;
}
set {
_name = newValue
}
}
}