Folder-like things in Xcode
I asked a private slack today why there’s three different kinds of folder-like things in Xcode, and here’s what I think I learned. (Thanks, friends!) I’m posting this so I can remember it and so you, dear reader, can correct my remaining misunderstandings.
- Blue folders look a lot like Finder’s folder icons, and that’s a good mnemonic, because that’s all Xcode does with them. It just knows that this folder exists in the file system and (usually) lets you edit files inside it. These files cannot be members of Targets and they won’t be involved in compiling. They can still be relevant to the Project if, say, there’s a build step that copies them to the Products directory. It seems like adding an empty folder to Xcode confuses the app, and then it will never show files in that folder. (IOU a radar?)
- Manila folders represent a Group in Xcode. A file inside a Group can be a member of one or more Targets (specified in the File Inspector, or the Target’s “Compile Sources” step), and it will get compiled when the target is built. These groups also exist as folders in the file system. A file can be in the file system folder without being in the group, so remember to add it in both the file system and Xcode, or add it in Xcode and let Xcode copy/move the file in the file system.
- A manila folder with a triangular shadow in the lower left corner is a virtual Group. Xcode knows these files have something to do with each other, but they’re not organized together on the file system. It seems like this is one of those features that you don’t want to use unless you know you need to.