The Files in a Project

If you’ve been checking your ~/Calculator directory while stepping through this chapter, you’ll probably have noticed that several files were automatically created in it. This section will discuss what these files contain and how they fit into a project.

PB’s Groups & Files pane uses an outline view to list each project file by type, as shown in Figure 5-31. You can display the different types of files in this outline view by clicking the disclosure triangle next to a file type (e.g., Resources, Frameworks). In Table 5-1, we summarize what each file type means.

Groups & Files pane in Calculator’s main window in PB

Figure 5-31. Groups & Files pane in Calculator’s main window in PB

Table 5-1. Cocoa file types

File type

Typical extensions

Meaning

Classes

.h, .m, .mm

Objective-C class interface (.h) and implementation (.m) files. The .mm extension is used for Objective-C++ source code files.

Other Sources

.c, .m, .mm

ANSI C (.c) and Objective-C (.m) source code files (e.g., main.m).

Resources

.nib, .strings

Resources used by the application, including the IB (.nib) files and strings tables.

Frameworks

.framework

Library files that are linked into your program (e.g., Cocoa and Foundation).

Products

.app

Applications that have been built with PB.

The main.m Program File Generated by PB

When you create a project, PB generates an Objective-C file called main.m containing the program’s

Get Building Cocoa Applications: A Step by Step 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.