Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you move an Xcode 4.2 project file to another folder?

Not crazy about the way Xcode 4.2 has laid out the files on disk. It creates a project file, then a single subfolder next to it that has all the code. We want the project file to be in that same folder, then the workspace file (if any) to be the folder's sibling. Makes for more portable layouts.

However, I can't STAND the lack of Save-as in Lion, and now, apparently Xcode 4.2 as well. At least with TextEdit I just grabbed the version from SL and it works. No such luck with Xcode as as you know, it's a completely different animal than Xcode 3.x.

So... how does one move/rename the project file relative to the source code?

like image 288
Mark A. Donohoe Avatar asked Feb 12 '12 01:02

Mark A. Donohoe


People also ask

How do I copy a file from one project to another in Xcode?

Knowledge BaseClick the arrow button to the right of the file and select Move or Copy file from the dropdown menu. When you choose Copy this file from the move or copy dropdown, you will then be able to select which project to copy it to. You can make a copy of the file in the existing project or in another project.

Where do I put Xcode files?

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 transfer Xcode project to another Mac?

Transferring Between MacsOpen Xcode and go to Organiser. Select your team or developer profile on the left toolbar. Click export at the bottom. Type in a useful filename then press save.


1 Answers

Here is how you do it (I'm using in Xcode 4.3):

First, move your project file
1. Start out by closing the Xcode project 1. Move ProjectName.xcodeproj into the folder with all your code
1. Open the XCode project by clicking ProjectName.xcodeproj

Second, re-map your files
1. You do not need to remap the files one by one, you only need to map the groups
1. Open the "File Inspector" with ⌥⌘1 or View->Utilities->Show File Inspector
1. Click each group, then click the square icon (see screenshot below) and choose the folder your project file is in.

Icon to click: enter image description here

"None" will show up when you choose the same folder your .xcodeproj file is in.

Conclusion:
I have a large project which contains ~650 files, but only 12 groups, so it takes just a few minutes to re-map everything.

Note:
Sometimes when mapping the files it doesn't recognize a folder change if the name is the same (ie. two folders with the same name). You may have to pick any other folder temporarily, then choose the actual project folder and the None indicator will appear.

like image 111
bentford Avatar answered Oct 23 '22 14:10

bentford