Working with Projects
Apps you create in Xcode require a project, which keeps the necessary files and resources organized. You start a project by choosing File > New > New Project. Xcode opens a new workspace window and displays a dialog in which you choose a project template. Xcode provides built-in templates for developing common styles of iOS, watchOS, and OS X apps. These templates include essential project configuration and files that help you start your development effort quickly.
View the names of project files in the project navigator. When you select a file in the project navigator, the file’s contents appear in the appropriate editor or viewer. The screenshot below shows the Adventure project. An implementation file (
APAViewController.m) is selected in the project navigator, and the file’s contents appear in the source editor.
A Project Is a Repository of Files and Resources for Building Apps
A project contains the elements needed to build one or more apps (or other software products, such as command-line tools and plug-ins). The project also maintains the relationships among these elements. These elements include:
References to source code files (including implementation files and header files where appropriate), libraries and frameworks, image files, and user interface files
Groups, for organizing files in the project navigator
Project-level build configurations
Targets, each of which produces a single app
By selecting the project name in the project navigator, you open the project editor. You can use the project editor to specify every aspect of how your apps should be built, from the version of the software development kit (SDK) to specific compiler options. In this screenshot, the Adventure project is selected in the project navigator and in the project editor. The project editor displays the Info pane for the Adventure project.
When you create a project, Xcode provides two standard project-level build configurations: debug and release. These configurations differ mostly in whether they include debug information and in the degree to which each build is optimized. These two build configurations are probably sufficient for your product development needs. Most developers never need to change the values of the vast majority of build settings.
To add more build configurations, open the project editor, duplicate one of the project’s existing configurations, and then modify its settings. For example, you might configure a build that’s fully optimized but that also includes debug information in order to debug your optimized code.
Closing and Opening a Project or a Workspace
To close a project or workspace, choose File > Close Project or File > Close Workspace. Xcode remembers which windows you had open and how they were configured, and it restores them when you reopen the project or workspace.