Xcode Project

Xcode is Apple's development environment for creating apps for OS X and iOS. It runs on OS X systems (current Macintosh platforms) but also cross-compiles and simulates the running of apps for iOS (for iPhones, iPads, etc.).

An Xcode project file, with the extension .xcodeproj, is actually a subdirectory (folder). This is common in OS X file formats these days; the Finder treats them as single files and opens the appropriate application (Xcode in this case) when they are clicked, but they can be seen as directories when you go into the Unix-based command-line terminal (where you can use the "cd" command to enter these directories, and the "ls" command to list them, like any other directory), or when you access them over a network from a non-Apple operating system.

The .xcodeproj file/directory/folder contains various files related to the development project it is part of. However, the actual program source files aren't in it. There is, in fact, an entire cluster of files and directories that are created by Xcode in conjunction with a newly-created project, and only some of them are within the .xcodeproj "file".

Project-related files outside the .xcodeproj file
When you create a project called "MyProject", Xcode will create a directory (a regular one, which looks and acts like a folder to Finder, not a special kind of directory like the .xcodeproj file which acts like a single file) called MyProject beneath whatever location you selected in which the project should be placed (your desktop, your user home directory, some subdirectory of it, etc.). All files related to the project get placed within this directory.

Within this directory is found these items (they may vary depending on the version of Xcode and the target operating system of the app, as well as other characteristics of the project):


 * Another subdirectory also named MyProject. This has the rather redundant path MyProject/MyProject. All the "content" files of your project such as program sources end up placed within this. Under this directory are:
 * .m and .h source files of Objective-C
 * MyProject-info.plist, a file with some overall settings of the project/app, expressed in Property List/XML format.
 * MyProject-Prefix.pch, a precompiled header file with global headers to be prefixed to the source files
 * Language-specific .lproj subdirectories (e.g., en.lproj for English); there may be several if the app is being localized for multiple languages. Under this directory are:
 * Strings Files (.strings) giving localized strings to be used in the program for a particular language (e.g., Localizable.strings, InfoPlist.strings). These are in the UTF-8 text-based format of strings files here, but get converted to other formats (UTF-16 or binary) to be placed within the app file when a project is built.
 * Nib files, Xib files, or Storyboard files, depending on the Xcode version and target OS. These set up user interfaces.
 * Credits.rtf: this RTF (Rich Text Format) file gives program credits to be shown within the help menu of the app.
 * MyProject Tests: Another directory parallel to the one with all the project source files but within the top-level directory of the project; it contains files of similar types to the project sources, but instead of containing the app sources themselves, it contains sources for automated tests to be run on the app.
 * MyProject.xcodeproj: Finally you get to the Xcode project file itself, actually a subdirectory. Its contents are described in the next section.

Contents of the .xcodeproj file

 * project.pbxproj: The main "project file within the project file". It is in a format which somewhat resembles C program code, but made extremely cryptic through the use of lots of raw hexadecimal constants. Lots of settings related to the project are configured here.
 * project.xcworkspace: A subdirectory that stores things related to user workspaces within the project.
 * contents.xcworkspacedata: An XML file listing the top-level-entity projects that are part of this project.
 * xcuserdata: A subdirectory containing data relating to specific users of the project.
 * username.xcuserdatad: Subdirectories named with the username of the developer; there may be multiple such directories in a multi-user project. Each of these stores data related to a particular user's workspace status.
 * UserInterfaceState.xcuserstate: A Property List/Binary file giving the state of the user's workspace (what files are open, the cursor position in them, etc.)
 * xcuserdata: Another directory with user-specific info, this one directly within the project file/directory.
 * xcuserdata: A subdirectory containing data relating to specific users of the project.
 * xcschemes: A directory within the user space.
 * MyProject.xcscheme: An XML file.
 * xcschememanagement.plist: A Property List/XML file.

Links and references

 * Stack Overflow discussions on the meaning and relevance of these files:
 * Is the project xcworkspace file important?
 * How important is pbxproj?
 * What do all the changes to xuserstate and xscheme files represent?
 * Discussion of -prefix.pch best practices