Migrating from Eclipse to Xcode

To Xcode xPerts: I've been doing Java in Eclipse for about 9 years, and I'm really used to powerful refactoring tools. There are several operations that I do all the time. I am looking for equivalents in Xcode, as it has better objective-c support than eclipse. (I'm not on my Mac as I write this, so some of them are from memory. I'm still very new to Xcode.)

1 "rename".

It looks like the Xcode equivalent for variables is “edit everything in scope”. Does this also work for files / classes / methods?

2 "extract local variable"

select the expression that creates the local var initialized by this expression. It even creates a usable name for the variable.

3 "extraction method"

select some code and it will create a method with this code and the corresponding parameters / return value.

4 "inline" (variable or method)

opposite the statement, embeds all or only the selected occurrence of the selected var or method.

5 "find next"

the appearance of the selected text. In eclipse, I can select the text and press ctrl-k to go to the next entry in the file. Similarly, shift-ctrl-k finds back. IIRC Xcode "find next" ignores the selection and uses only what is in the search field.

6 "signature change method"

This would be very useful with the syntax for the ocjective-c parameter messages with the name. This is great for adding parameters to a method.

7 "pull-up / push-down"

to move methods up or down the class hierarchy.

8 "move"

to move items around other classes, etc.

These are the ones that I use all the time. According to my estimates, these tools have reduced the encoding time in half. Are any of them supported in Xcode?

Thanks in advance for any advice.

+4
source share
3 answers

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

+1
source

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

0
source

Yes, right-click on the symbol and select "Refactoring".

There does not seem to be a “signature method of change". I have used this feature for many years in other IDEs. I assume that the only thing to do in xcode is to change the signature and hope that you get a compilation error for everything that needs to be changed ... not a great refactoring tool.

Xcode looks slippery in many ways, but there are some annoying omissions (does anyone want to view the contents of the collections in the debugger?)

0
source

Source: https://habr.com/ru/post/1307094/


All Articles