インライン化
インライン化リファクタリングでは、メソッド、変数 (Objective-C の場合)、およびクロージャ (Swift の場合) の抽出リファクタリングを反転させることができます。
インライン化するコードフラグメントにキャレットを配置します。
Ctrl+Alt+N を押すか、コンテキストメニューまたはメインメニューからを選択します。
Swift 用: 開いたダイアログで、リファクタリングの実行方法を選択します。

リファクタリングの結果をプレビューするには、Objective-C の場合は使用箇所の表示、Swift の場合はプレビューをクリックします。

以下はメソッドをインライン化した結果です。
前
後
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" }前
後
- (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"; }