Extract instance variable
Last modified: 14 December 2022Language: Objective-C
Shortcut: Ctrl+Alt+F
With the Extract Instance Variable refactoring, you can place an expression into an instance variable.
The refactoring is available for Objective-C only.

Perform the Extract Instance Variable refactoring
In the editor, select an expression you want to replace with an instance variable.
Press Ctrl+Alt+F or select Refactor | Extract/Introduce | Instance Variable 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.
Select a name for the instance variable from the list of suggestions that opens or type a new one.
If you want to create a property for the variable or declare it in the interface, select the corresponding checkboxes in the popup that opens.
Press Enter.
Before | After |
---|---|
|
|
Thanks for your feedback!