Xcode: How to refactor/rename method and ADD (or REMOVE) its PARAMETERS?
Asked Answered
S

2

17

Is Xcode 5 able to change method's signature? As far as I can tell no, but I'd like to be shown wrong.

If I either try to add (or remove) a method's parameter, I am welcomed by the Needs 1 fewer (more) colon to match original error.

Must I really do a manual refactor in this case?

Shore answered 20/2, 2013 at 18:31 Comment(1)
This is not possible with Xcode 6 also.Bikol
D
0

Mark the first method name with the colon ("startRequest:") and then click on Refactor-> Rename

Example:

- (void)startRequest:(NSString *)url with:(NSDictionary *)post

http://developer.apple.com/library/ios/#recipes/xcode_help-source_editor/RefactorRenaming/RefactorRenaming.html

Dittmer answered 19/3, 2013 at 15:32 Comment(2)
At first, I was taken aback by your suggestion that it matters which part of the method you right-click on (i.e. startRequest: rather than with:), but now I see that you probably misread my question: can you add/remove a parameter?Shore
No I can't add/remove parametersDittmer
S
0

As far I have also been unable to find a way to do this. In general Xcode is not very good for refactoring.

Therefore, I want to suggest you to look for other IDEs to use for refactoring. As a matter of fact, this is almost a common approach. I am unable to point you which IDE would be ideal for this though, but there are a few options.

Snooker answered 28/8, 2013 at 15:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.