Overview of the Project Navigator in Xcode
You have to work within the context of an Xcode project to develop an iOS app. After you have created your project in Xcode, the Xcode workspace displays the Project navigator.
Xcode has a lot of context-based help. Whenever you’re curious about what something does, try Control-clicking in an area, and you’ll likely find a menu with a Help selection. This figure, for example, shows what happens when you Control-click in the Project navigator. It brings up a shortcut menu from which you can choose the Project Navigator Help menu.
The Navigator area is an optional area on the left side of the Workspace window where you can load different navigators — including the Project navigator — with the help of the Navigator selector. To hide or show the Navigator area, click the left View selector button in the workspace toolbar, shown in this figure.
The Navigator area includes the Navigator selector bar, the Content area, and the Filter bar. It can also include other features specific to the selected navigator.
The Project navigator enables you to do things like add, delete, group, and otherwise manage files in your project or choose a file to view or edit in the Editor area. (Depending on which file you choose, you’ll see the appropriate editor.)
In this figure, for example, all the disclosure triangles are open so that the Project navigator displays all the files in the project.
The Filter bar lets you restrict the content that’s displayed — such as recently edited files, unsaved files, or filenames.
Making your way down the folder structure shown in the Project navigator (refer to the figure), the first folder listed is labeled RoadTrip (which is the name of this sample project). This folder contains all the source elements for the project, including source code, resource files, graphics, and a number of other pieces.
Although each template organizes these source elements in different ways, the Master-Detail Application template organizes the interface header and implementation code files (along with the Storyboard file(s) and a Supporting Files folder) inside the RoadTrip folder. (For good measure, the RoadTrip folder also includes a Frameworks folder and a Products folder.)
Here’s the kind of stuff that gets tossed into folders for projects like the RoadTrip project:
AppDelegate files: The RTAppDelegate.h and RTAppDelegate.m files contain the code for app-specific behavior that customizes the behavior of a framework object (so that you don’t have to subclass it).
A behavior-rich framework object (used as is) delegates the task of implementing one of its responsibilities to an application delegate for a very specific behavior.
Storyboard: The storyboard files live in your project as the MainStoryboard.storyboard_iPad file and the MainStoryboard.storyboard_iPhone file (for a universal app), or just as a lone MainStoryboard.storyboard_whatever file (for a device-specific app).
With a storyboard, you can create and implement an overall view of the flow of your application and the user interface elements.
View controllers: The RTMasterViewController.h and RTMasterViewController.m files contain the code to control the initial view of the RoadTrip (based on the Master-Detail Application template).
Supporting Files: In this folder, you typically find the precompiled headers (header files that are compiled to reduce your application compilation time) of the frameworks you’ll be using — such as RoadTrip_Prefix.pch — as well as the property list (RoadTrip-Info.plist) and main.m, your application’s main function. You may even find images and other media files, and some data files.
The InfoPlist.strings file is used for localization (translating the text in your app to the user’s language preference).
Frameworks: This folder holds the code libraries that act a lot like prefab building blocks for your app. By choosing the Master-Detail Application template, you let Xcode know that it should add the UIKit, Foundation, and CoreGraphics frameworks to your project, because it expects that you’ll need them in this kind of application.
Products: The Products folder is a bit different from the others. In it, you’ll find the final RoadTrip.app file — not the source code of the app, but rather the built version of the app, which means that it has been translated from the source code into the object code for the iPad’s processor to execute.
At the moment, this file is listed in red because the file can’t be found.
When a filename appears in red, this means that Xcode can’t find the underlying physical file. And because you’ve never compiled the RoadTrip app, it makes sense that the RoadTrip.app file (the app itself) is missing.
You may notice that some items in the Project navigator look like folders, but you’ll soon discover that they often don’t act like folders. If you just happen to open the RoadTrip folder on your Mac — outside of the Xcode context — you won’t see all the “folders” that appear in the Xcode window. That’s because those folders are simply groupings that help organize and find what you’re looking for.