How to rename the class name in swift?

Currently you can't refactor in Swift. However, you can do Find menu > Find and Replace in Project. (Carefully)

Edit: Xcode 9 allows you to refactor.

Highlight your property/function and choose Editor Menu -> Refactor -> Rename

Wait a second or two for Xcode 9 to scan your project for all occurrences and then type the new name.


Now it's possible in Xcode 9.

Right click on class name and choose Rename.


After doing what @Caroline has pointed out, you should also change the name of your .swift file because it does not change using Find > Find and replace.... For doing that, you can click on the name of a .swift class and rename it as you want.

enter image description here

I am using XCode 8 and it is the best option I could find to change the name of my class in the whole project.

Tags:

Ios

Swift