Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explanation of Xcode settings for folders added to project

What is the difference between "Create groups for any added folders" and "Create folder references for any added folders"?

I have been doing this for quite some time now, but to be honest I don't know what's the difference between the two.

like image 551
Ankit Srivastava Avatar asked Jan 13 '12 13:01

Ankit Srivastava


People also ask

How do I add folders to Xcode project?

Xcode offers several ways to add existing files and folders to your project: Drag the files from the Finder into the Project navigator. Click the Add button (+) in the Project navigator's filter bar, and choose Add Files to “projectName”. Choose File > Add Files to “projectName”.

What do the letters next to files in Xcode mean?

Those letters beside files in the Project Navigator of Xcode show the status of files that are under version control systems, such as SVN or Git. So, for instance: M - means the file has changed and it should be merged into SCM. A - means this is a new file and should be added to SCM.

What does a red folder mean in Xcode?

It means they are not found on disk where your project believes they should be. Control-click and Show In Finder to see the folder location to locate the file and drag it back in to the project, and delete the bad reference.

Where does Xcode place the files that created when it builds your project?

It should by located in: ~/Library/Developer/Xcode/DerivedData .


2 Answers

Groups are only within your project and are for organization purposes only. They do not reflect what is on the file system nor where the files will be compiled into in the app.

Folders are basically like including a folder on the file system, where if you move a file within a folder reference, it will be reflected in your project as well. These folders are also reflected inside your app bundle when its compiled.

I usually use groups. For example, on the file system I have all my classes in a /Classes folder but have them separated in my project into groups, such as View Controllers, Custom Views, Data Model, etc. These don't really need to be separate in the file system but its nice to have in the project.

Sometimes I'll use folder references if it's important for the organization be maintained once it goes to the app bundle, but that is pretty rare. Also, when including files from a third party library that could be updated often, you can use a folder reference so you don't have to remember to add files when they are added to the library.

like image 172
Philippe Sabourin Avatar answered Oct 02 '22 15:10

Philippe Sabourin


When you create folders in your project the folders are also present in you apps bundle. Groups are ignored and all files in the groups are added to the apps bundle root.

like image 41
rckoenes Avatar answered Oct 02 '22 16:10

rckoenes