Alberto Scampini
Alberto Scampini

Reputation: 798

How to add a prefix to a lot of existing swift files and classes in Xcode

I'm working on a project and I created a lot of swift classes. As you know with swift you do not need to add a prefix in front of the class or file name; and so I didn't.

Now I was required to add a prefix to them (let's say "KK" in front of each file and class)

I was wandering if someone managed to do this with a single command, I would like to avoid renaming and refactoring each class one by one.

example:

a file called FridgeView.swift containing a class FridgeView should be renamed KKFridgeView.swift and the class KKFridgeView

P.S. I know we do not need prefix in swift but it is a requirement of my company I really have no choice :)

Upvotes: 0

Views: 1367

Answers (2)

Vicky_Vignesh
Vicky_Vignesh

Reputation: 592

Step One Click the Project Name

![Project Name]1

Then you can find Class Prefix on you right Side

This Image

Add your prefix and then Create all you viewController and Class

Upvotes: 0

Mohammad Parvez
Mohammad Parvez

Reputation: 417

It can be set from file inspection menu but it will only new files added into project. it will not impact already added files.

enter image description here

Upvotes: -1

Related Questions