The Document Architecture

Applications that deal with multiple documents have a lot in common. Every such application can create new documents, open existing documents, save or print open documents, and remind the user to save edited documents when they try to close a window or quit the application. AppKit supplies three classes that take care of most of the details for you: NSDocumentController, NSDocument, and NSWindowController. Together, these three classes constitute the document architecture.

The purpose of the document architecture relates to the Model-View-Controller design pattern discussed in Chapter 1. In RaiseMan, your subclass of NSDocument acts as the window controller. It will have a reference to the model objects, ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.