Adding Folder to Xcode Project is not Properly added Adding Folder to Xcode Project is not Properly added xcode xcode

Adding Folder to Xcode Project is not Properly added


If your Xcode project looks like this…

Xcode project with folder reference

…then you've added your ViewControllers folder as folder reference.

To change this folder to a group follow these steps:

  • Right click on ViewControllers
  • Choose Delete in the context menu
  • Choose Remove Reference in the dialog that popped up. The folder will be removed from your Xcode project but not from the file system.
  • Then choose Add Files to <YourProjectName>… in the File menu
  • Find your ViewControllers in the file system
  • Before clicking Add make sure that the option Create groups is selected
  • Click Add

You've added your ViewControllers folder as group:

Xcode project with folder group


Important note regarding Xcode 8:

The option Create groups might not be visible right away. Apple moved this in Xcode 8 to the bottom of the Add Files to… dialog:

Collapsed options

This reveals the option Create groups:

Expanded options


The only option that ever works for me is to drag and drop files and folders directly from Finder into the project hierarchy.

I have struggled with this simple task for ages. It's 2021 and the simple action of right clicking (or using the file menu) to "Add files to " just doesn't seem to ever work for me. It will add the files, but they will not be added as dependencies in the project. Their headers won't be found, etc. No option for adding groups or folders pops up.

The only thing that works for me is to open a Finder window, navigate to the directory that has the software I want to paste in and then drag and drop it into my project hierarchy. That is the only way I get the proper option for adding groups or folders. Having just spent 30 minutes trying to follow the advice above, I thought I'd post my solution.