< Previous PageNext Page > Hide TOC

The Project Window

The project window is where you do most of your work in Xcode. The project window displays and organizes your source files, targets, and executables. It allows you to access and edit all the pieces of your project. To work effectively in Xcode, you need to recognize the parts of the project window and understand how to use them to navigate your project’s contents.

Of course, everyone has their own way of organizing their workspace. To help you be as efficient and productive as possible, Xcode provides several project window layouts. A project window layout specifies a particular arrangement for a project window, as well as ancillary task-specific windows.

This chapter introduces project window components and describes the available project window layouts. It also introduces other important Xcode windows and provides tips on using the Xcode interface to locate information on project items.

In this section:

Project Window Components
Project Window Layouts
The Inspector and Info Windows
Viewing the Progress of Tasks in Xcode


Project Window Components

Figure 1-1 identifies some of the components of the project window using the default layout. You can add, remove, and configure these components to your liking.


Figure 1-1  The default project window layout

The default project window layout

The project window contains the following key areas for navigating your project:

The project window also contains a text editor pane that lets you edit files directly in the project window. You can navigate through the views in a window, except the text editor pane, by pressing Tab.

For a description of each of the available project window layouts, see “Project Window Layouts.”

The Groups & Files List

The Groups & Files list provides an outline view of your project’s contents. The contents of your project—files, folders, targets, executables, and other project information—are organized into groups. A group collects related files.

Using the Groups & Files list, you can:

Group Types

The Groups & Files list contains two types of groups: static groups and smart groups, identified in Figure 1-2.


Figure 1-2  Groups & Files list

Groups & Files list

Static groups organize your project’s source files, including header files, implementation files, frameworks, and other files. (Static groups are themselves grouped under the project group, which is named after the project and is represented by the blue project icon.) A static group, identified by a yellow folder icon, can contain any number of files and other static groups. Static groups help you organize the files in your project into manageable chunks. The project group is a static group that contains all the files, frameworks, libraries, and other resources included in your project.

Smart groups are subdivided into two types: built-in smart groups and custom smart groups.

For more information on using static groups and smart groups to organize your project items, see “Grouping Files.”

Viewing the Contents of Groups

You have a couple of options for viewing the contents of a group in the Groups & Files list. If you prefer the outline view, you can open the group directly in the Groups & Files list. You can also select one or more groups to view their contents in a simple searchable list in the detail view (see “The Detail View” for details).

To view or hide the contents of a group in the Groups & Files list, use its disclosure triangle.

To view the contents of a group in the detail view, select the group in the Groups & Files list. In general, the detail view shows more item information than the Groups & Files list.

You can display additional attributes for the items shown in the Groups & Files list using the shortcut menu in the list header (Control-click the header to show the shortcut menu). A column for each attribute appears on the left side of the list.


Group item shortcut menu

Displaying and Hiding Smart Groups

As described in “Group Types,” an Xcode project has a number of smart groups that organize particular types of project items. These groups help you find information such as symbols or build errors. However, you may not need to display all the smart groups in the Groups & Files list.

To specify which smart groups the Groups & Files list displays, use the Preferences submenu in the shortcut menu that appears when you Control-click an item in the Groups & Files list.

To rearrange a smart group, drag it to its new position in the Groups & Files list.

To delete a group, select it and choose Edit > Delete. You can restore deleted groups using the Preferences menu described earlier.

Splitting the Groups & Files View

In large projects, the Groups & Files list can get long, making it difficult to move items around. You can split the Groups & Files view for a project by clicking the Split button, shown in Figure 1-3.

Each Groups & Files view can display a different area of the Groups & Files list, making it easy to keep frequently accessed groups handy or to move items between groups. You can drag the resize control between the views to redistribute the space between them. To remove a Groups & Files view, click the Close Split button.

By default Xcode splits the view vertically. However, you can also split a view horizontally. To split a view horizontally, hold down the Option key while clicking the Split button.


Figure 1-3  Split Groups & Files view

Split Groups & Files view

The Detail View

As you learned, the Groups & Files view lets you see the contents of your project in an organized outline. In contrast, the detail view shows you items in a flat list. You can quickly search and sort the items in this list, gaining rapid access to important information in your project.

You control the scope of the information shown in the detail view with your selection in the Groups & Files list. If the selected item is a group, the detail view displays information for all the members of that group and of any subgroups that it contains. You can select multiple items in the Groups & Files list; the detail view displays the selected items and their members.

Note: The content of groups such as frameworks and bundles is shown in the detail view only when that framework or bundle is directly selected in the Groups & Files list, to avoid mixing items such as external framework headers and project headers.

Information Displayed in the Detail View

The type of information displayed in the detail view varies, depending on the item selected in the Groups & Files list. For example, if you select a group of source files in the Groups & Files list, the detail view displays each of the files in that group, along with information about those files, such as the file’s build status or code size. However, build status and code size make no sense for errors and warnings, so when you select the Errors and Warnings group, you see a list of error and warning messages and the locations at which they occur.


Figure 1-4  Detail view columns

Detail view columns

This is the information available in the detail view:

Not all of these columns are visible by default. You can choose which columns are shown in the detail view by using the shortcut menu that appears when you Control-click anywhere in the header. You can display many of these same columns in the Groups & Files list, using the same mechanism. For more information, see “The Groups & Files List” and “The Detail View.”

Note: Some columns in the detail view are required, depending on the currently selected group. These columns do not appear in the shortcut menu.

You can display the columns of the detail view in any order. To reorder the columns, drag the heading of any column to its new position.

You can also reveal the selected item in the detail view in the Groups & Files list. For example, if the current selection in the detail view is an individual source file, Xcode selects that file in the Groups & Files list, disclosing the contents of any static groups that the file belongs to, as necessary. To reveal the detail view selection in the Groups & Files list, choose View > Reveal in Group Tree.

Searching and Sorting in the Detail View

With the detail view you have a couple of ways to find and view information. You can sort the contents of the detail view according to the information in any of the visible categories simply by clicking the column heading for that category. For example, to sort by filename, click the File Name heading.

Using the search field in the toolbar, you can quickly search the contents of the detail view. As you type, Xcode filters the contents of the detail view, displaying only those items that have matching text in at least one of the columns.

The search field supports several types of search; you can choose the search type from the pop-up menu in the search field. Xcode supports the following searches:

Figure 1-5 shows an example of a sting matching search.


Figure 1-5  Searching for files with “delegate” in their name

Searching for files with “delegate” in their name

As you type, the status bar displays the scope of the search—the current selection in the Groups & Files list—and the number of items found. Pressing the Home key or choosing the project item (indicated by the project icon) from the search field’s pop-up menu changes the focus of the search field to the whole project.

The Project Window Toolbar

The project window toolbar gives you quick access to the most common Xcode commands. Figure 1-6 shows the project window toolbar in the default layout (for more on project window layouts, see “Project Window Layouts”).


Figure 1-6  Project window toolbar

Project window toolbar

You can customize the project window toolbar by choosing View > Customize Toolbar and dragging toolbar items into or out of the toolbar to get the set that is most useful to you.

The Project Window Status Bar

The project window status bar shows the progress of the current operation in Xcode. It gives you feedback during potentially lengthy tasks, such as building, and also displays the results of those tasks. In particular, the status bar lets you quickly access important information about project operations. From the status bar, you can:

Project Window Layouts

There are many factors affecting the optimal workspace arrangement for you. Ask yourself questions such as the following: How much screen real estate do I have? What do I spend most of my time working on? How many projects do I normally have open at once?

Configuring your working environment to allow you to be as productive as possible is critical. Whatever your preferred workflow, Xcode provides several project window layouts for you to choose from. Xcode defines the following layouts:

You set the window layout for your environment in the General pane in Xcode preferences. From the Layout menu, choose the Default, Condensed, or All-In-One layouts. Selecting a layout from this menu shows a brief description of the layout below the menu. Note that you cannot change the project window layout when any projects are open; you must first close all open projects. The project window layout is a user-specific setting; it applies to all projects that you open on your computer.

This section describes each project window layout and the differences between them.

The Default Layout

The default project window layout, shown in Figure 1-1, contains three main views:

Although you can accomplish most of your daily development tasks in the project window, Xcode also provides a number of other task-specific windows that let you focus on a particular part of the development process. Table 1-1 shows the separate windows available in the default layout.

Table 1-1  Additional windows available with the default project window layout

Window

Use to

Build Results

View the build system output generated when you build a target.

Debugger

Debug your program; you can control execution of your code; view threads, stack frames and variables; and so forth.

SCM

View the status of files under source control.

Project Find

Search for text, symbol definitions, and regular expressions in your project.

Console

View information or messages logged by your program when running in Xcode and interact with the debugger on the command line and see debugger commands and output.

Class Browser

View the class hierarchy of your project and browse classes and class members.

Breakpoints

View and edit all breakpoints set in your project.

Bookmarks

View your project’s bookmarked locations in a dedicated window.

The Condensed Layout

The condensed layout provides a smaller, more compact version of the project window, shown in Figure 1-7. In this layout, the project window contains several panes, each showing a subset of the items in your project in the Groups & Files list. You can switch between these panes using the buttons below the toolbar.


Figure 1-7  The condensed project window

The condensed project window

The condensed project window layout contains three panes:

You can jump to any of the built-in smart groups, opening the appropriate pane if necessary, by choosing an item from the Smart Groups submenu of the View menu.

The condensed layout provides the same additional windows as the Default layout, listed in Table 1-1. The condensed layout also includes the additional windows shown in Table 1-2.

Table 1-2  Additional windows available with the condensed project window layout

Window

Use to

Editor

Edit project files. Although each of the available layouts let you open files in a separate editor window, the condensed project window is the only one that does not include an attached editor; when you open a file from the project window, Xcode opens a new editor window.

Detail

View and search your project’s contents in a simple list. The condensed layout does not include a detail view in the project window; however, by choosing View > Detail, you can open a separate Detail window that includes a Groups & Files list on the left side of the window and a detail view on the right side.

The All-in-One Layout

The all-in-one project window layout provides a single project window in which you can perform all the tasks necessary for software development. In this layout, you can edit files, view project items in an outline view or detail view, view build system output, run and debug your executable, search, and more. The all-in-one layout provides two views, or pages. To switch between pages, use the Page toolbar item, shown in Figure 1-8. The available pages are:

In the all-in-one layout the project window has a page-specific toolbar, which contains items specific to the development tasks performed in that page.

The Project Page

The project page, shown in Figure 1-8, lets you perform typical project management tasks. You can view the contents of your project in outline view, search for project items in the detail view, perform a projectwide find, and view status for the files under source control in your project.


Figure 1-8  The all-in-one project window

The all-in-one project window

The project page contains the Groups & Files list, which shows the contents of your project in outline view; a text editor pane, which lets you edit source files right in the project window; and a tabbed view, which lets you switch between several panes, each of which provides an interface for a common project management task. These panes are:

Other Windows in the All-In-One Layout

The all-in-one layout is designed to let you perform project management tasks in the project window; it does, however, include a few additional windows, listed in Table 1-3. These windows let you view content already available from the project window in a separate window, should you choose to do so.

Table 1-3  Additional windows available with the all-in-one layout

Window

Use to

Class Browser

View the class hierarchy of your project and browse classes and class members.

Breakpoints

View and edit all breakpoints set in your project.

Bookmarks

View your project’s bookmarked locations in a dedicated window.

Project Find

Perform a projectwide search and view search results in a separate window. This window shows the same information as the Project Find pane of the project page.

SCM

View the status of files under source control in your project. This window contains the same information as the SCM pane of the project page.

Saving Changes to the Current Layout

The project window layouts give you the flexibility to choose the arrangement that best suits your preferred workflow. You can further customize your work environment by saving the changes that you make to the windows in an open project and applying them to all projects using that layout.

For example, in the condensed layout the project window has three panes, each of them focused on a particular subset of a project’s groups. The Files pane shows only the project group, which contains all files and folders in the project. The Other pane shows all smart groups. If you want access to both your project files and your bookmarked locations in the same pane, you could add the Bookmarks smart group to the Files pane by dragging it from the Other pane to the Files button and then the Files pane.

Note:  If the Bookmarks smart group exists in another pane, choosing View > Smart Groups > Bookmarks opens that pane in the project window. However, if you have previously deleted the smart group from the project window, choosing View > Smart Groups > Bookmarks adds that smart group to the current pane.

To save this change, and have the Bookmarks smart group appear in the Files pane for all projects using the condensed layout, choose Window > Defaults.

In the dialog that Xcode displays, click Make Layout Default to save your changes to the current layout. Clicking Restore To Factory Default discards all of your changes—both current changes and those you’ve previously saved—to the current layout. Xcode restores the original configuration settings for the layout.

You can save changes to:

The “Save window state” option in General preferences saves the state of the open windows for each project when you close that project. However, when you choose Window > Defaults, you save layout details that apply to all projects when you open them using the modified layout.

The Inspector and Info Windows

Knowing how to use Xcode’s user interface to find and view project items and information is essential to working efficiently in Xcode. Xcode gives you a number of ways to find and access project contents. In previous sections, you learned how to use the Groups & Files list to see an organized outline view of your project and how to use the detail view to quickly filter project contents. Using these tools, you can view as wide or as narrow a cross-section of your project as you choose.

These tools, however, aren’t as useful when you wish to view or modify individual items in your project. For this, Xcode provides inspector and Info windows. These windows are for managing the selected item’s essential details. For any particular item in your project, its Info window and the inspector display the same information. However, the two windows behave differently.

The amount of information visible in the status bar is limited and it reflects only operations in the current project. To let you view a more detailed account of all operations in Xcode, Xcode provides the Activity Viewer window (see “Viewing the Progress of Tasks in Xcode”).

The inspector tracks the current selection in the project window. As you select different files, targets, and groups in the project window, the inspector changes to show information about that item.

The Info window continues to display information about the items that were selected in the project window when you opened it, regardless of the current selection. You can have multiple Info windows open at a time, each describing a different set of items of your project.

The Info button in the project window toolbar displays an Info window for the currently selected item. You can add an Inspector button to the toolbar.

You can also use menu commands (or their keyboard shortcuts) to display Info windows or the inspector window. Choose File > Get Info to display an Info window. Hold down the Option key and choose File > Show Inspector to display the inspector.

Xcode provides Info windows and inspectors for the following project items:

The type of information displayed depends on the type of item you are editing. Specific Info windows are described in more detail where the items that they modify—files, targets, projects, groups, and so forth—are discussed. In general, however, if you are at a loss as to how to make a change to a basic project item, try displaying its Info window. Throughout this document, wherever the inspector window is used, remember that you can also use an Info window, and vice versa.

Viewing the Progress of Tasks in Xcode

The Activity Viewer window lets you watch the tasks currently in progress in Xcode. While the Tasks button in the project window toolbar lets you control the progress of tasks in the current project (such as a program launched by Xcode in order to debug it), the Activity Viewer lets you see the progress of all Xcode tasks across all open projects. The Activity Viewer provides a single, persistent window that you can leave open to monitor the progress of all running tasks. To open the Activity Window, shown in Figure 1-9, choose Window > Activity Viewer.

You can also click the progress indicator in the project window status bar.


Figure 1-9  Activity Viewer window

Activity Viewer window

The operations in the Activity Viewer are grouped by project; you can show or hide the operations specific to any project using the disclosure triangle next to the project name. To stop any of the tasks shown in the Activity Viewer, simply click the stop sign icon next to that task. You can cancel the most recently initiated operation in the active project by pressing Command–period.



< Previous PageNext Page > Hide TOC


© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-01-06)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.