AppCode
 
Get AppCode

Extract variable

Last modified: 21 July 2022

Language: Swift, Objective-C

Shortcut: Ctrl+Alt+V

If you come across an expression that is hard to understand or it is duplicated in several places throughout your code, the Extract Variable refactoring Ctrl+Alt+V can help you deal with those problems placing the result of such expression or its part into a separate variable that is less complex and easier to understand. Plus, it reduces the code duplication.

https://resources.jetbrains.com/help/img/idea/2023.1/ac_export_variable_sample.png
Gif