Extract parameter
Last modified: 17 March 2022Language: Objective-C
Shortcut: ⌃ ⌥ P
The Extract Parameter refactoring lets you extract a new parameter to a method.

Gif
Extract a parameter
In the editor, place the caret within the expression that you want to introduce as a parameter.
Press ⌃ ⌥ P or select Refactor | Extract/Introduce | Parameter from the main or context menu.
If there are several expressions available for extracting, select the required one from the list that opens and press ⏎.
Type the name of the newly created parameter or select one of the suggested values.
If you want to declare the generated parameter as a constant, check Declare const in the popup that opens.
Press ⏎.
Objective-C
Before | After |
---|---|
|
|
Thanks for your feedback!
Was this page helpful?