I am trying to rename the class name in swift but it gives me error Can't refector swift code
. I want to know the best way to rename a file that will reflect in the whole project
Right-click on the class name in the interface ( . h ) file, choose Refactor->Rename , and Xcode will guide you through the process, allowing you to preview changes before you commit to them. Xcode will let you review the changes before you commit.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With