(iOS) Rename your Xcode Project
When you make an app, you might feel like renaming the app name before you publish it. For me, the process was a bit more complicated than I thought. In this article, I try to summarize all the process I needed to take to rename the app.
1. Change the names manually
First, you need to rename the project name with the blue file icon manually.
Then the pop-up like below shows up. Just click ‘Rename’ button.
2. Rename the scheme
Next, you need to rename the project scheme. Go to ‘Menu bar > Product > Scheme > Manage Schemes’ and rename the Scheme name manually.
3. Rename the main files
At this point, the project names in your project folder are still old. To change the names, go to open your ‘Terminal’ and move to your project directory using ‘cd’ command. Then simply add the code below.
mv OldProjectName NewProjectName
4. Replace all occurrences of your old project’s name
Now the project folder name has been replaced. Then you want to rename all the occurrences of your old project names in your files. In order to do that, execute the command below on your Terminal.
NOTE:
It might bring up the pop-up window in Xcode saying ‘Revert’ or ‘Keep Xcode version’.
In that case, choose ‘Revert’ to update the names.
grep -Rl "YourOldProjectName" * | xargs sed -i "" "s/YourOldProjectName/YourNewProjectName/"
5. Rename the project name in your Podfile
If you’re using ‘Cocoapods’ in your app, you also need to update your ‘Podfile’.
Replace the old project names in your Podfile with the new one and install.
Note:
The names beside ‘project’ and ‘target’ might have been already changed at this point.
6. Build and Run
When you try to build, you might face an error here. If you see an error like below, just click on the project name with the blue icon and go to ‘Your project name under TARGETS > General > Linked Frameworks and Libraries’ section. If you find ‘Pods_YourOldProjectName.framework’, just delete that row.
That’s everything!
Reference:
- How to Rename An Xcode Project
https://digitalleaves.com/blog/2017/06/rename-xcode-project/ - An article written in Japanese
http://kimagureneet.hatenablog.com/entry/2017/01/21/001103