How do I refactor Swift in Xcode?

Paul Van Wieren picture Paul Van Wieren · Nov 3, 2015 · Viewed 22.7k times · Source

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?

Answer

Dániel Nagy picture Dániel Nagy · Nov 3, 2015

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