Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you keep Xcode project source files in sync with your file system directories?

I'm new to XCode and I find the file management a huge pain. In most IDEs, you can simply have the project source tree reference a directory structure on disk. This makes it easy to add new files to your project - you simply put them on disk, and they will get compiled automatically.

With XCode, it appears I have to both create the file and separately add it to the project (or be forced to manipulate the filesystem through the UI). But this means that sharing the .xcodeproj through source control is fraught with problems - often, we'll get merge conflicts on the xcodeproj file - and when we don't, we often get linker errors, because during the merge some of the files that were listed in the project get excised. So I have to go and re-add them to the project file until I can get it to compile, and then re-check in the project file.

I'm sure I must be missing something here. I tried using 'reference folders' but the code in them doesn't seem to get compiled. It seems insane to build an IDE that forces everyone to modify a single shared file whenever adding or removing files to a project.

like image 567
Scott S Avatar asked Feb 20 '10 21:02

Scott S


People also ask

Where are Xcode files stored?

Most caches are stored in ~/Library/Caches, including the Xcode cache. You'll find Xcode's cache at ~/Library/Caches/com. apple.

What is project Navigator in Xcode?

After you have created your project in Xcode, the Xcode workspace displays the Project navigator. The Navigator area is an optional area on the left side of the Workspace window where you can load different navigators — including the Project navigator — with the help of the Navigator selector.

How do I import a folder into an Xcode project?

In the Project navigator, select the project, then choose Product > Import Localizations. In the import dialog that appears, select the Xcode Localization Catalog folder, and click Import. Xcode ingests the files and warns you if there are untranslated files.


1 Answers

Other answers notwithstanding, this is absolutely a departure from other IDEs, and a major nuisance. There's no good solution I know of.

The one trick I use a lot to make it a little more bearable — especially with resource directories with lots of files in them — is:

  • select a directory in the project tree,
  • hit the delete key,
  • choose "Remove References Only", then
  • drag the directory into the project to re-add it.

This clobbers any manual reordering of files, but it does at least make syncing an O(1) operation, instead of being O(n) in the number of files changed.

like image 70
Paul Cantrell Avatar answered Oct 10 '22 08:10

Paul Cantrell