I am using a separate, second “standAlone" Window to display a 
SplitViewController. Design is StoryBoard, for an OS X application.
From appDelegate, I instantiate the SplitViewController in 
“applicationDidFinishLaunching"


let storyBoard = NSStoryboard(name: "Main", bundle: nil)
resultWindowController = 
storyBoard.instantiateControllerWithIdentifier("ResultController") as! 
NSWindowController
resultWindowController.showWindow(self)

In this particular “testBed” configuration, I initialized a Core Data Stack in 
AppDelegate. My goal is to initialize the splitViewItem’s  context once 
AppDelegate has setup the stack.

In the end, I resorted to posting a notification in 
“applicationDidFinishLaunching"

 "NSNotificationCenter.defaultCenter().postNotificationName("SetUpComplete", 
object: self.managedObjectContext)” 

for the interested parties, but this seems to duplicate a lot of code in each 
of the children’s view controllers.

viz

 NSNotificationCenter.defaultCenter().addObserverForName("SetUpComplete", 
object: nil, queue: NSOperationQueue.mainQueue()) { (notification) -> Void in
            
            self.managedObjectContext = notification.object as! 
NSManagedObjectContext
   }

where  “managedObjectContext” is simply a var in the Child View Controller

Is there a simpler way of doing this? Maybe initializing the actual 
splitViewController and using this as a source of the context for it’s children?

Thank you.


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to