Extract block parameter
Last modified: 08 March 2021Language: Objective-C
With the Extract Block Parameter refactoring, you can create a block declaration based on the selected chunk of code within a method. As a result, the created block is passed as a parameter to this method, and all existing usages of this method are changed accordingly.

Gif
Extract a block parameter
In the editor, select a chuck of code (within a method) which you want to replace with a block declaration.
Select Refactor | Extract/Introduce | Extract Block Parameter from the main or context menu.
In the dialog that opens, type the name of the block. If necessary, add/delete parameters, edit parameter names and types, and click Extract.
Before | After |
---|---|
|
|
Thanks for your feedback!
Was this page helpful?