Renaming a Swift project using Xcode and Emacs

1 minute read

You may need to rename a project to better reflect the app’s evolved feature set, e.g., from LiveTranscribeJP to OmniScribe. Here is how to apply this rename to your codebase.

Step 1: Update the Name throughout the Codebase

In Emacs, you can use projectile-ripgrep or projectile-replace to find and replace the name tokens. Do this only to those in the source code files, and skip files associated with project management.

Step 2: Perform the Project Rename in Xcode

To fully rename the app (including the icon name on the dock and the file structure), follow these steps in Xcode:

  1. Rename Project:

    1. In the Project Navigator (left sidebar), click on the blue project icon LiveTranscribeJP.
    2. Press Enter to rename it. Type OmniScribe and press Enter.
    3. Xcode will ask to rename targets and schemes. Click Rename.
  2. Rename the source folder:

    1. In the Project Navigator (left sidebar), click on the source folder icon LiveTranscribeJP.
    2. Press Enter to rename it. Type OmniScribe and press Enter.
  3. Rename Scheme:

    1. Click the scheme selector (top bar, next to the Play button).
    2. Select Manage Schemes….

    3. Select LiveTranscribeJP, press Enter or click on it, and rename it to OmniScribe.
  4. Update Bundle Identifier (Optional):

    1. Click the Project icon -> Select the Target -> Signing & Capabilities.
    2. Change Bundle Identifier to com.yourname.OmniScribe.
  5. Update Info.plist:

    If you see Bundle name or Bundle display name in your Info.plist, ensure they use $(PRODUCT_NAME) or are manually updated to OmniScribe.

  6. Update Info.plist path in Build Settings:

    1. Open Project Settings: Click on the blue project icon (now named OmniScribe) in the left Project Navigator.

    2. Select the Target: In the center panel, select the OmniScribe target (under "Targets").

    3. Go to Build Settings: Click the Build Settings tab at the top.

    4. Search for Info.plist: Type Info.plist in the search bar (top right of the settings list).

    5. Update "Info.plist File":

      1. Locate the row named Info.plist File (Key: INFOPLIST_FILE).
      2. Double-click the value on the right.
      3. Change the path to point to the correct location of your file.

    If this path isn't set correctly you may see this error:

    Build input file cannot be found: ‘/path/to/LiveTranscribeJP/Info.plist’. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

Comments