
Refactorator: Xcode Plugin That Refactors Swift - ingve
https://github.com/johnno1962/Refactorator
======
sparky_
Very cool. But the fact that a (fairly complex!) third party plugin was
required to do things like rename constants is tragic. Where is the first-
party support for basic edits in Xcode, two years after the release of the
language?

~~~
jernfrost
It is annoying, but they had far bigger problems to fix from release until
now. When Swift was released SourceKit would crash all the time. The compiler
would crash when code wasn't correct. The error messages were terrible. The
language had was missing essential parts. Apple had to do a lot of fixing to
get to where we are now. The things they have fixed has been a lot more
important to get right than the refactoring support. Crash free IDE, good
error messages, stable compiler, user friendly handling of optional types has
been far more important IMHO. But now the language is looking good, so I think
starting with Swift 3.0 I think we will start to see xCode getting fixed.

It might also be intentional to give a marked to AppCode and others. xCode has
always been pretty slim in the offerings when it comes to refactoring. But
xCode contains a lot more tools than what you get in e.g. AppCode. There is
considerably more effort going into creating good GUI designers, UI Automation
tools, performance diagnostic tools, debugger, playground etc.

AppCode has a much smaller scope and can thus focus more on being a great tool
for refactoring.

~~~
weaksauce
> When Swift was released SourceKit would crash all the time

it still does that if your code is sufficiently broken.

------
cellularmitosis
An Xcode tip which I didn't discover until recently was that if you hover over
a variable for a moment, a small down arrow will appear next to it. If you
click on that arrow, you'll get a menu which includes "Edit all in scope".
This provides very basic variable renaming.

~~~
micampe
Without using the mouse and hovering you can press Cmd-Ctrl-E.

------
Fargren
The lack of these refactorings is the main reason I bought AppCode. It comes
with it's own set of problems, so I find myself using two IDEs a lot of the
time. Does this plugin at least support Extract Method, or is it just Rename?

~~~
hboon
I'm curious, being a fan of keeping a copy of AppCode just for refactorings:
What problems?

~~~
Fargren
Let me preface by saying I like AppCode a lot more than XCode; given the
choice I always work on AppCode.

But, my complaints are:

-Much slower startup time

-All in all, it feels less responsive than XCode when my computer is struggling(I do cross-platform development with Android, so on occasion I'm running Xcode+AppCode+Android Studio at once)

-For projects with multiple targets, changing a file from one target to another does not have a good UX. I work in projects with several targets, and I have to do this more than most developers, and it always takes me to XCode

-Choosing and editing launch configurations has a better UX in XCode

-Editing plist files, project configurations and Storyboards is significantly easier in XCode

-AppCode will occasionally show spurious errors and warnings. It warns me any time I call [UIImageNamed:] with an image in my asset catalog, for example, saying the resource does not exist.

-The update cycle lags behind XCode's by necessity.

~~~
sriram_iyengar
This summary is useful for me as I'm planning to get my personal license soon.

