プロパティ監視:
プロパティ値が設定される前と設定された後に処理を行う
willSet 設定される前に処理
didSet 設定された後に処理
swift言語を学ぶ:プロパティー
var detailItem: AnyObject? {
didSet {
// Update the view.
self.configureView()
}
}
func configureView() {
// Update the user interface for the detail item.
if let detail: AnyObject = self.detailItem {
if let label = self.detailDescriptionLabel {
label.text = detail.description
}
}
}
コメント