Configure the Array Controller

Since the book is setup for older versions of Swift and Xcode (I’m using Xcode 7, and Swift 2) I think I’m stuck on the step in where I’m supposed to:

[quote]bind the array controller’s managedObjectContext to File’s Owner’s managedObjectContext[/quote] It looks like there are no IBOutlets for me to bind it to.

This stack overflow article looks helpful, but I’m not quite sure what to do: … ect-contex

Any help/suggestions would be greatly appreciated. I’ve really enjoyed the book so far.

An NSArrayController has a property managedObjectContext which is shown as an outlet when you right-click it in InterfaceBuilder.
This is what you are seeing and trying to connect.

However there is the ‘other’ approach of binding to a variable and for that you use the Bindings Inspector which you access in the right inspector panel.
The NSArrayController has an entry there for managedObjectContext and there you’d bind it to your viewcontroller’s managedObjectContext variable.

That of course requires that your viewcontroller has a property that provides the managedObjectContext.
Subsequently whenever you set your viewcontroller’s managedObjectContext property in code, your arraycontroller gets notified and updates its own.

That way, the array controller will always have access to the same managedObjectContext as your viewcontroller.

So don’t use the outlet for the property on your NSArrayController but rather the BindingsInspector.

If that doesn’t make sense I’ll see if I can find some place to upload images for a screenshot.

That makes complete sense. Thank you!