The ViewController class doesn't have much to do here, but it does need to expose a reference to the NSManagedObjectContext that is maintained by the AppDelegate class.
Add the following property to the ViewController class:
var managedContext = (NSApplication.shared().delegate as! AppDelegate).managedObjectContext
And believe it or not, that's all we'll be adding to the ViewController class. In fact, it's the only code we'll be adding at all in the first half of this chapter.