Xcode 4 Differences for Chapter 2

Changes in Chapter 2, "Your First Application," relate to a few menu items and overall window layout differences, plus the fact that Interface Builder is now integrated into the Xcode environment.

The changes in these posts are divided by section headings, in the order these appear in the book.

The Xcode Environment

The menu item you need is File > New > New Project… (Shift-Cmd-N).

When you choose to create a Cocoa Application, the checkbox for Create Document-Based Application is on a separate screen. You’ll need to fill out the options as shown here:

The Options for a New Cocoa Application Project in Xcode 4

(Most of these are filled out automatically—all you need to type is the Product Name, and then make sure the Create Document-Based Application checkbox is left unticked)

The Project Window

When the project is created, you’ll see a window that looks like this:

The Xcode 4 Window for a New Project

The main.m file is located within the Supporting Files group, and in Xcode 4, the list of files in the top half above the editor area shown in Fig 2.2 is no longer used:

The Xcode 4 Window for main.m

2.2 The Main Event

The Build & Run icon is now just a Play button, at the top left of the main toolbar.

2.4 Application Resources

The Xcode 4 project templates don’t keep resources in a separate Resources group; the TextApp-Info.plist file is inside the Supporting Files group.

The MainMenu.xib file is inside the top TextApp group; when you open this file (with a single click), it is displayed by Xcode inside the primary window:

The Xcode 4 Window for MainMenu.xib

The objects you see in Figure 2.4 in the book are shown down the lefthand side of the editor panel in Xcode 4. You’ll find only one click is necessary to display any of these items ready for editing.

When you make a change to any item, the .xib file will automatically be saved when you press the Play button to “build and run.”

Adding to Our Basic Interface

The Library palette is now part of the main Xcode 4 window, but you need to find it. Choose View > Utilities > Object Library (Ctrl-Opt-Cmd-3), and the panel will open at the bottom right of the window:

The Xcode 4 Interface Object Library

To display TextApp’s window object ready to receive a text view, just click it in the list of objects on the left:

The Xcode 4 Interface Editor for a Window