I have a project named XXX
. I want to rename this project to YYY
.
Note that XXX
is an extremely common term (for e.g. "data", or simply "project"), and thus a simple RegEx search-and-replace is not possible, out of risk of corrupting the project configuration files.
My current project directory contains the following items:
XXX
XXXTests
XXX.xcodeproj
and I want to rename them to:
YYY
YYYTests
YYY.xcodeproj
... respectively, with the necessary changes being reflected in my project file.
How can I accomplish this without having to manually create and populate a new project?
Edit: It is absolutely ridiculous that this has become my most upvoted question :p
To change the project name;
2.In the Identity and Type section of the File inspector, enter a new name into the Name field.
3.Press Return.
A dialog is displayed, listing the items in your project that can be renamed. The dialog includes a preview of how the items will appear after the change.
To selectively rename items, disable the checkboxes for any items you don’t want to rename. To rename only your app, leave the app selected and deselect all other items.
Press "Rename"
To add to @luke-west 's excellent answer:
When using CocoaPods
After step 2:
OLD.xcworkspace
toNEW.xcworkspace
.After step 4:
Podfile
from the project navigator. You should see atarget
clause with the OLD name. Change it to NEW.OLD.podspec
file.rm -rf Pods/
pod install
.Build Phases
tab.Link Binary With Libraries
, look forlibPods-OLD.a
and delete it.Step 1 - Rename the project
Step 2 - Rename the Scheme
Step 3 - Rename the folder with your assets
Step 4 - Rename the Build plist data**
Info.plist
, andProduct bundle identifier
Info.plist
Product Identifier
Finally, you are done and can rebuild (Command + Shift + K to clean, Command + B to build)
Extra instructions when following @Luke-West's + @Vaiden's solutions:
If your scheme has not changed (still showing my mac) on the top left next to the stop button:
Also, I did not have to use step 3 of @Vaiden's solution. Just running
rm -rf Pods/
in terminal got rid of all old pod filesI also did not have to use step 9 in @Vaiden's solution, instead I just removed the OLD project named framework under Link Binary Libraries (the NEWLY named framework was already there)
So the updated steps would be as follows:
Step 1 - Rename the project
Step 2 - Rename the Scheme
Step 3 - Rename the folder with your assets
Step 4 - Rename the Build plist data
Step 5 Handling Podfile
rm -rf Pods/
You should be able to build with no errors after you have followed all of the steps successfully
There is a GitHub project called
Xcode Project Renamer
:Xcode Project Renamer
A quicker solution using shell commands (works with CocoaPods too):
PLEASE
cd
TO A NON-GIT REPOSITORY BEFORE PROCEEDING ⚠️Step 1 - Prerequisites
/NewProjectFolder
OUTSIDE your git repository. ⚠️ changes to .git could corrupt your git index