Inline
The Inline refactoring lets you reverse the Extract refactoring for a method or variable.
Place the caret within the code fragment you want to inline.
Press ⌃⌥N. Alternatively, select
from the main or context menu.In the dialog that opens, click View usages if you want to preview the refactoring results. To apply the changes, click Inline.
Below is the result of inlining a method.
Before | After |
---|---|
- (void)setupUI {
// ...
// This method will be inlined
[self setupLabel];
}
- (void)setupLabel {
self.labelInfo.textColor = [UIColor blackColor];
self.labelInfo.text = @"Your email and password";
}
|
- (void)setupUI {
// ...
// Inlined code
self.labelInfo.textColor = [UIColor blackColor];
self.labelInfo.text = @"Your email and password";
}
|
Last modified: 08 March 2021