Build the Application

In this section you’ll create the basic infrastructure of the To Do application. First, you’ll create an NSDocument subclass. Next, you’ll implement the data model class for the application and set up the basic user interface for To Do documents. Finally you’ll implement the set of methods the ToDoDocument class uses to accept, organize, display, and store entered data. When you’re finished with this chapter, the application will allow you to click a day on the calendar and enter a list of to-do items. In Chapter 13 and Chapter 14, you’ll expand on the work you do here to make To Do a full-fledged Mac OS X application.

Create the Project

Create a new Project Builder project named To Do using the Cocoa Document-based Application template as a project starting point.

Every Cocoa application project created with Project Builder has the same main function (in the file main.m). When users double-click an application or document icon in the Finder, main (the entry point) is called first; main, in turn, calls NSApplicationMain—and that’s all it does.

The NSApplicationMain function does what’s necessary to get a Cocoa application up and running—it responds to events, coordinates the activity of its objects, and so on. This function starts the network of objects in the application sending messages to one another. Specifically, NSApplicationMain:

  • Gets the application’s attributes, which are stored in the application wrapper as a property list. From this property ...

Get Learning Cocoa now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.