Search code examples
cocoansviewcontroller

Proper usage of NSViewController representedObject


I have a NSViewController managing a NSTableView and noticed that NSViewController has a representedObject property, however it isn't an IBOutlet and I'm not able to bound the dataSource of NSTableView to the representedObject property of NSViewController in interface builder. How is representedObject property suppose to be used? Are there any examples of proper usage?


Solution

  • The representedObject property should be set to an object that lives outside of the nib, such as the document, another model-controller, or a model object. Things in the nib should get the data from the VC or the VC's representedObject.