AppCode 2022.3 Help

Inline

The Inline refactoring lets you reverse the Extract refactoring for a method , variable (for Objective-C), and closure (for Swift).

  1. Place the caret at the code fragment you want to inline.

  2. Press ⌃ ⌥ N or select Refactor | Inline from the context or main menu.

  3. For Swift: in the dialog that opes, select how the refactoring should be performed:

    Inline method in Swift
  4. If you want to preview the refactoring results, click Show usages for Objective-C or Preview for Swift:

    Show usages in Objective-C
  5. Below is the result of inlining a method.

    Before

    After

    private func setupUI() { // // This method will be inlined setupLabel() } private func setupLabel() { self.labelInfo.textColor = UIColor.black self.labelInfo.text = "Enter your email and password" }
    private func setupUI() { // Inlined code self.labelInfo.textColor = UIColor.black self.labelInfo.text = "Enter your email and password" }

    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: 14 December 2022