21

In Xcode IDE when I add a new group named 'Organizer' inside the default Classes group it is getting created. But when I physically see the folder in the Finder, that new group Organizer is not showing as a folder.

Actually I want to maintain the sources in a particular structure i.e, how it exists in the XCode view.

What should I do to achieve this?

2 Answers 2

32

You should create all necessary folders within Finder and then add them to project (right mouse click -> Add files to XYZ project). While adding files, options should look like this:

enter image description here

UPD: Xcode 9 finally supports automatic folder creation and file reordering for groups operations!

Sign up to request clarification or add additional context in comments.

5 Comments

What a complete and total arse this is
@burrows111: As everything in Xcode. I suppose it is the worst IDE ever! Is there any setting to force creating folders by default?
Actually, storing all the h/m files in a single folder is not as mad as it seems: you can alter the structure of the project groups whenever you want to and whenever it's needed — say, by some big architectural change or smth else. Plus git blames won't be affected in that case. I personally prefer not to use folders at all.
@knuku it's bad let me tell you why. Sometimes you just want to do stuff to a bunch of files within the file system. you can't. you have to fire up xcode and find out which ones are grouped with which... let's say you want to mail over "images" folder to the designer so they can do stuff with it. and within that "images" folder, there are "thirdPartyImages" folder. how can you do that in the File system? Also, xcode -> group -> show in finder... you know where it takes you? Not to the group of files you are looking for. It takes you to the root of the project.
@TatiOverflow beg my pardon but I was speaking about sources only, not images or other assets (which are better to be referred via xcassets which is quite another topic). besides that I would consider a source control rather then mailing any files along. although, I wouldn't explicitly label either approach bad or good. In my experience with both huge (around 1k h+m file pairs) and small iOS projects the approach with storing all the sources in single folder suits great for any needs.
1

If you are adding a new group named Organizer inside the default classes group you cant see the physical folder in finder. To make physical folder you should do following steps,

1. Prepare folder structure with files in it. 2. Drag that folder into xcode i.e. project navigation pan. 3. Check the box " Copy items into destination group's folder (if needed) " 4. Select " Create groups for any added folders " 

After doing this, you will get your folder in finder. Now if you want to add new file then just

1. Right click on folder and click " Add files to < Project_Name >" 2. Select proper file 3. Check the box " Copy items into destination group's folder (if needed) " 4. Select " Create groups for any added folders " 5. Finally click to add 

You will get that folder with new file added into that.

Note : Keep in mind you get yellow colored folder.

Thank You.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.