I am trying to make a migration of my existing OSX app to make use of storyboard and have some difficuty along the way. Traditionally the window contoller loads the nib file so that I can easily find out the document object which should be connected to the object controllers contained in the nib file by referencing the window controller's document property via file's owner reference.
However under storyboard scheme, window and content view are separated so that the object controllers contained in the view controller scene have no direct access to the window controller. Since under storyboard scheme, view controller should act like file's owner, I believe view controller should have the capability to find out the related document object but I could not find it so far.
Would someone please suggest me the good way to make connection between view controller and the related document object?
The only (ugly) way I found so far is something like below:
within view controller's viewDidAppear method,
-(void)viewDidAppear
{
[super viewDidAppear];
NSView* view = self.view;
NSWindow* window = view.window;
NSWindowController* wc = window.windowController;
NSDocument* doc = wc.document;
self.representedObject = doc;
}