KVC and Property Accessors
KVC will call setters and getters for properties, if they are present. To see this in action, add accessors for temperature:
dynamic var temperature = 68 private var privateTemperature = 68 dynamic var temperature: Int { set { println("set temperature to \(newValue)") privateTemperature = newValue } get { println("get temperature") return privateTemperature ...
Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.