What is an .xcodeproj file?

Xcode tracks “projects” with a file called SomeProject.xcodeproj.

Actually, like workspaces, it’s not a file at all - it’s a directory.

The important file in it is project.pbxproj (“Project Builder XCode Project”).

The rough syntax looks like:

// !$*UTF8*$!
{
  foo = {
    isa = blah;
    jtzht = (
      qux /* jyrjhetz */,
      barf /* grhtz */,
    );
    bam = 0;
  };
	bar = blah /* some comment */;
}

So you have:

It’s roughly JSON in its expressiveness.

The first is special and mandatory: it indicates the encoding of the rest of the file.

A project.pbxproj file is pretty big; it contains boatloads of settings about your project. It mainly says:

The overall schema is pretty simple:

// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {
    FD9C41C61DDE16AB001EC7D1 = ...;
    FD9C41D31DDE16AB001EC7D1 = ...;
    ...
  };
  rootObject = FD9C41C61DDE16AB001EC7D1;
}

The objects dictionary is the important bit. It defines a GRAPH. The keys of the dictionary are the vertices, and each object definition can reference other objects. Xcode creates odd IDs for objects, e.g. FD9C41C61DDE16AB001EC7D1.

A distinguished object is the rootObject. This defines the project.

There are a few different kinds of “object”. Each is a dictionary with an isa property. There are many types: PBXBuildFile, PBXFileReference, PBXFrameworksBuildPhase, PBXGroup, PBXNativeTarget, PBXProject, PBXHeadersBuildPhase, PBXResourcesBuildPhase, PBXSourcesBuildPhase, PBXVariantGroup, XCBuildConfiguration, XCConfigurationList, PBXContainerItemProxy, XCConfigurationList, PBXTargetDependency.

The object dictionary is grouped by this type, with each section delimited by a comment, e.g.:

objects = {
/* Begin PBXBuildFile section */
		FD9C41D41DDE16AB001EC7D1 = ...;
		FD9C41DD1DDE1FD0001EC7D1 = ...;
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
		FD9C41CF1DDE16AB001EC7D1 = ...;
		FD9C41D21DDE16AB001EC7D1 = ...;
		FD9C41D31DDE16AB001EC7D1 = ...;
		FD9C41DC1DDE1FD0001EC7D1 = ...;
/* End PBXFileReference section */

...

/* Begin XCConfigurationList section */
		FD9C41C91DDE16AB001EC7D1 = ...;
		FD9C41D71DDE16AB001EC7D1 = ...;
/* End XCConfigurationList section */
};

Examples of objects:

I just released Vidrio, a free app for macOS and Windows to make your screen-sharing awesomely holographic. Vidrio shows your webcam video on your screen, just like a mirror. Then you just share or record your screen with Zoom, QuickTime, or any other app. Vidrio makes your presentations effortlessly engaging, showing your gestures, gazes, and expressions. #1 on Product Hunt. Available for macOS and Windows.

With Vidrio

With generic competitor

More by Jim

Tagged . All content copyright James Fisher 2016. This post is not associated with my employer. Found an error? Edit this page.