tags:

views:

87

answers:

3

To Xcode xPerts: I have been doing Java in Eclipse for about 9 years now and I have really gotten used to the power of the refactoring tools. There are a few operations I do all the time. I am looking for equivalents in Xcode since it has better support for objective-c than eclipse. (I'm not at my Mac as I write this. So some of this is from memory. I am still very new to Xcode.)

1 "rename".

It seems that the Xcode equivalent for variables is "edit all in scope". Does this work for files/classes/methods too?

2 "extract local variable"

select an expression it creates a local var initialized to that expression. It even creates a usable name for the variable.

3 "extract method"

select some code and it will create a method with that code and appropriate parameters/return value.

4 "inline" (variable or method)

opposite of extract, inlines all or just the selected occurrence of the selected var or method.

5 "find next"

occurrence of selected text. In eclipse I can select some text and hit ctrl-k to go to the next occurrence of that in the file. likewise shift-ctrl-k finds backwards. IIRC the Xcode "find next" ignores the selection and only uses what is in the find box.

6 "change method signature"

This would be very useful with ocjective-c's named parameter messaging syntax. This is great for adding parameters to a method.

7 "pull-up/push-down"

for moving methods up or down the class hierarchy.

8 "move"

for moving elements around to other classes etc.

Those are the ones that I use all of the time. I have estimated that these tools cut my coding time in half. Are any of these supported in Xcode?

Thanks in advance for any advice.

A: 

For #1, if you right click a symbol name, you should have the Refactor menu option that permits you to rename the ivar, property, type name (including file names), etc.

Daniel A. White
A: 

You can read the Xcode user documentation on Refactoring on any machine. It will answer most of these questions.

cdespinosa
Thanks. That's a great link. Bookmarking that one.
Gloin the Dark
A: 

Yep, right-click on a symbol then select Refactor.

There doesn't appear to be a "change method signature". I've used that feature for years in other IDEs. I guess the only thing to do in xcode is change the signature and hope that you get a compile error for everything that needs changing...not a great refactoring tool.

Xcode look slick in many ways, but there are some annoying omissions (anyone want to view the content of collections in the debugger?)

spymaster