Develop Your App in the Workspace Window
Perform your core development tasks in the Xcode workspace window. The workspace window is your primary interface for creating and managing projects. The workspace window automatically adapts itself to the task at hand, and you can further configure the window to fit your work style. You can open as many workspace windows as you need.
The workspace window has five main components.
The workspace window always includes the editor area. When you select a project file, its contents appear in the editor area, where Xcode opens the file in an appropriate editor.
The workspace window can also display three optional areas. You hide or show these optional areas by using buttons in the view selector in the toolbar:
Show and hide the navigator area. The navigator area is where you view and maneuver through files and other facets of your project.
Show and hide the debug area. The debug area is where you control program execution and debug code.
Show and hide the utility area. You use the utility area for several purposes, most commonly to view and modify attributes of a file and to add ready-made resources to your project.
Navigate Your Workspace
Access files, symbols, unit tests, diagnostics, and other facets of your project from the navigator area. In the navigator selector bar, you choose the navigator suited to your task. The content area of each navigator gives you access to relevant portions of your project, and each navigator’s filter bar allows you to restrict the content that is displayed.
Choose from these options in the navigator selector bar:
Project navigator. Add, delete, group, and otherwise manage files in your project, or choose a file to view or edit its contents in the editor area.
Symbol navigator. Browse the class hierarchy of the symbols in your project.
Find navigator. Use search options and filters to quickly find any string within your project.
Issue navigator. View issues such as diagnostics, warnings, and errors found when opening, analyzing, and building your project.
Test navigator. Create, manage, run, and review unit tests.
Debug navigator. Examine the running threads and associated stack information at a specified point or time during program execution.
Breakpoint navigator. Fine-tune breakpoints by specifying characteristics such as triggering conditions.
Log navigator. View the history of your build, run, debug, continuous integration, and source control tasks.
Type text into the filter bar to restrict the items displayed in the content area of the navigator. Click the icons in the filter bar to display only recently changed files () or only files with source control status (). You can also add a file to the project by clicking the Add (+) button.
Select files in the content area to view or edit them.
Edit Your Project Files
Most development work in Xcode occurs in the editor area, the main area that is always visible within the workspace window. The editors you use most often are:
Source editor. Write and edit source code.
Interface Builder. Graphically create and edit user interface files.
Project editor. View and edit how your apps should be built, such by specifying build options, target architectures, and app entitlements.
When you select a file from the content area of a navigator, Xcode opens the file in an appropriate editor. In the screenshot, the file
iPhoneStoryboard.storyboard is selected in the project navigator, and the file is open in Interface Builder. (The optional utility and debug areas are hidden to maximize space for the navigator and editor.)
The following screenshot shows a number of search results appearing in the find navigator’s content area. One of the results is selected, and its text string appears in the source editor.
Configure the editor area for a given task with the editor selector, found in the toolbar. The editor selector offers three controls:
Standard editor. Fills a single editor pane with the contents of the selected file.
Assistant editor. Presents a separate editor pane with content logically related to that in the standard editor pane.
Version editor. Shows the differences between the selected file in one pane and another version of that same file in a second pane.
This screenshot shows an implementation file,
APAAdventureScene.m, open in the standard editor pane. The three optional workspace areas—navigator, debugger, and utility—are hidden to maximize the editor’s content display. Within the source code editor, the assistant pane displays the implementation file’s associated header file,
Every editor pane includes a jump bar—an interactive, hierarchical mechanism for navigating directly to items at any level in your project. The configuration and behavior of the jump bar is customized for its context. The basic jump bar configuration includes three components:
The related items menu () offers additional selections relevant in the current context, such as recently opened files or the interface (
.h) file for an implementation (
.m) file you are editing.
Previous/next buttons () allow you to step back and forth through your navigation history.
The hierarchical path menu is made up of one or more segments.
Click a segment in the hierarchical path menu to see a pop-up menu of related sub items. For example, if the segment identifies the name of the project, you can use the jump bar to find folders within the project. If the segment identifies the name of a folder, you can use the jump bar to find files within the folder. If the segment identifies the name of a source file, you can use the jump bar to find symbols within the file.
Perform Additional Workspace Actions in the Utility Area
The utility area gives you quick access to these resources:
Inspectors, for viewing and modifying characteristics of the file open in an editor
Libraries of ready-made resources for use in your project
The top pane of the utility area displays inspectors. The bottom pane gives you access to libraries.
Use the inspector selector bar to choose the inspector best suited to your current task. Two inspectors are always visible in the selector bar (additional inspectors are available in some editors):
File inspector. Manage metadata for a file, such as its name, type, path, location within your project, and so forth.
Quick Help. View details about a symbol, interface element, or a build setting in the file. For a method, for example, Quick Help displays a concise description, where and how the method is declared, its scope, the parameters it takes, and its platform and architecture availability.
Use the library selector bar to access ready-to-use libraries of resources for your project:
File templates. Model files for common types of files and code constructs.
Code snippets. Short pieces of source code for use in your software.
Objects. Items for your app’s user interface.
Media. Files containing graphics, icons, sound files, and the like.
You can type into the text field in the filter bar to restrict the items displayed in the selected library. To use a library, drag it directly to the appropriate area. For example, to use a code snippet, drag it from the library to the source editor; to create a source file from a file template, drag its template to the project navigator.
Manage Common Tasks with the Workspace Toolbar
The toolbar at the top of the workspace window provides quick access to frequently used commands. The Run button builds and runs your products. The Stop button terminates your running code. The Scheme menu lets you configure the products you want to build and run. The activity viewer shows the progress of tasks currently executing by displaying status messages, build progress, and other information about your project.
You’ve seen how the editor selector lets you configure the editor area, and you’ve seen how the view selector hides or shows the optional navigator, debug, and utility areas.
The View menu includes commands to hide or show the toolbar.
Work in Multiple Tabs or Multiple Windows
You can use Safari-style tabs to implement multiple, workflow-specific layouts of the workspace window. For example, you can use one tab to view a header file, another to view an implementation file, and another to view a user interface file.
The View menu contains commands to show or hide the tab bar. To create a tab, choose File > New > Tab. To remove a tab, move the pointer to the tab and click its close box.
You can also create multiple workspace windows by choosing File > New Window. Each tab or window can be customized independently of the others, for example, by showing and hiding the utility area with the utility area button () in the View selector.