2

Is there some easy way to rename Swift Package?

I tried some standard ways but there wasn't result in finding quickly solution

Please help me, thanks in advance


Sorry guys i put it badly. more description: I have created SP in the my workspace a some time ago and now there are a lot links (imports of this package) around all project and now I want to rename this package. Special tool not avalible for this and i was looking some ather way to avoing a lot of routine work

NoliNik
  • 113
  • 6

3 Answers3

1

Go into your Package.swift file and change any instance of your old name to your new name. Hit save, then your xcode project should update itself.

Dan
  • 141
  • 6
0

Sadly it doesn't look like there's a good way to do this, and when it's come up I've ended up making a new package with the correct name, moving all the code into it, and updating references to the old package to point to the new one.

Bee G
  • 1
  • 1
    https://stackoverflow.com/a/35500038/7860206 here's something you are looking for – Arash Afsharpour May 21 '21 at 16:41
  • Ah, that's renaming a project, not a package- thanks though! TBH I would go with the 'make a new package' approach, since this step-by-step is fragile and Xcode doesn't really give you the tools to debug these under-the-hood files. – Bee G May 24 '21 at 08:02
0

Unfortunately I only found a manual way to do it.

These are the steps that I did to change OldName to NewName:

  1. To change the package name that shown on Xcode, you can rename the root folder on your Finderenter image description here
  2. If your project are currently open, A popup will appear, you can just close the xcode.
  3. Then you can re-open your package.swift file again.
  4. Last, Rename the folder inside your Sources and Tests folder to the new name. Also adjust your file name too. enter image description
here
Muhammad Fauzi Masykur
  • 1,628
  • 1
  • 13
  • 17