Extract parameter
Last modified: 22 September 2022Language: Objective-C
Shortcut: Ctrl+Alt+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 Ctrl+Alt+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 Enter.
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 Enter.
Objective-C
Before | After |
---|---|
|
|
Thanks for your feedback!
Was this page helpful?