Learn more about Russian war crimes in Ukraine.

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:

What can computers do? What are the limits of mathematics? And just how busy can a busy beaver be? This year, I’m writing Busy Beavers, a unique interactive book on computability theory. You and I will take a practical and modern approach to answering these questions — or at least learning why some questions are unanswerable!

It’s only $19, and you can get 50% off if you find the discount code ... Not quite. Hackers use the console!

After months of secret toil, I and Andrew Carr released Everyday Data Science, a unique interactive online course! You’ll make the perfect glass of lemonade using Thompson sampling. You’ll lose weight with differential equations. And you might just qualify for the Olympics with a bit of statistics!

It’s $29, but you can get 50% off if you find the discount code ... Not quite. Hackers use the console!

More by Jim

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