标签:
didSet 的使用
var length: Int? { didSet { timeStr = String(format: "%02d:%02d:%02d", arguments: [length! / 3600, (length! % 3600) / 60, length! % 60]) } } var timeStr: String?
计算型属性(也可以说是 get 方法)
var title: String { get { return "Mr " + (name ?? "") } }
var title: String { return "Mr " + (name ?? "") }
标签:
原文地址:http://www.cnblogs.com/aiyiran/p/5049967.html