Search code examples
swiftrefactoringxcode7

How do I refactor Swift in Xcode?


Is there a way to refactor swift in Xcode 7.1?

When I try to rename a variable (e.g. highlight, right-click, refactor > rename), Xcode pops up an error dialog saying:

Can't refactor Swift code. Xcode can only refactor C and Objective-C code.

Is there a workaround for this?


Solution

  • AFAIK the refactoring is not working with Swift right now, however, at least in the same file(scope), you can do the following: enter image description here