For the More Curious: More on Key-Value Observing
How did the label become an observer of the temperature key in the MainWindowController object? The code to become an observer of this key might look something like this:
let mainWindowController = ... mainWindowController.addObserver(self, forKeyPath: "temperature", options: NSKeyValueObservingOptions.Old, context: &MyKVOContext)
This method is defined in NSObject. It is how you say, “Hey! Let ...
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.