Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Folder to Xcode Project is not Properly added

Team,

I created the new Project, on project folder right click open show in finder there I created "ViewControllers" Folder and again right click Add files to "ProjectName" then I added the created folder i.e., "ViewControllers" which is in blue colour "Expected yellow colour folder" that is reference to my project folder the blue colour folder is not. In blue colour folder when i try to added new file its added an empty File.

How can i reference my added folder to the Xcode project? how to avoid this blue colour folder class in my project?

Your inputs are highly appreciable.

like image 209
kiran Avatar asked Oct 11 '16 17:10

kiran


People also ask

How do I add a folder 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”.

How do I add missing files to Xcode?

Select all the missing files that are in one folder in Finder. Click the choose file button; it is under the Location drop down menu; it is an image that looks like a very small window with a document inside it. A Choose folder containing the selected references sheet should appear. Show activity on this post.

What are blue folders in Xcode?

Blue is used to represent a "Folder Reference". There are two types of folders in Xcode: groups and folder references. You can use groups to organize files in your project without affecting their structure on the actual file system.


1 Answers

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

like image 182
mxgzf Avatar answered Oct 03 '22 19:10

mxgzf