Project files in Finder and Xcode

Imagine we have a basket of apples. I track this apples using a piece of paper and a pencil.

As we can see, although I have a separate categories for green and red apples on paper, in reality all apples are stored together in one basket. A contents of a basket is still reflected on my list correctly. My list obeys certain rules:

  •  if I add an apple on paper, it appears in the basket, otherwise the tracking wouldn’t be of use
  •  if I remove an apple from the basket, the line in my list corresponding to it does not represent an existing object anymore

With this picture in mind, let’s have a look at Xcode project files and how they correspond to files on disk in the project folder

Project in Xcode
Project in Xcode

We see that groups in Xcode project navigator and folders in Finder may not be of exact match.

Project in Finder
Project in Finder

The file named BaseConverter.xcodeproj contains all information about how to build the project. We can open the project by double-click it.
There are some rules present:

  1. The Base converter group looks real, it exists as a folder on disk. If we add more files to this folder through Xcode, they most likely will appear at this folder in Finder as well
  2. The Supporting files group doesn’t show itself on disk, it is just a way to combine some items together inside Xcode project so that’ll be easier to work with them. Contents of this group is real, however, and we can find this files on disk.
  3. Similar story happens with Base Converter group. The group exists only inside Xcode project, but the files are present in Finder.

The groups are used to make a navigation in project more intuitive, but they do not alter file structure on the disk. We create groups, by choosing File -> New -> Group

Frameworks and Products groups are different cases – they don’t correspond to anything in the project folder, but they correspond to real things that the project needs to build and run.

Also, as new users, we may get in trouble by messing with project folder in Finder. The easiest way to avoid this is to perform all our interactions with the project through project window in Xcode.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s