标签:
getter & setter
很少用,以下代码仅供了解
private var _name: String? var name: String? { get { return _name } set { _name = newValue } }
var title: String { get { return "Mr " + (name ?? "") } }
var title: String { return "Mr " + (name ?? "") }
var title2: String { return "Mr" + (name ?? "") }
lazy var title: String = { return "Mr " + (self.name ?? "") }()
标签:
原文地址:http://www.cnblogs.com/-liangjingjing/p/5350386.html