Change signature
Shortcut for the action: ⌃ F6
General refactoring settings: Preferences | Editor | General
The Change Signature refactoring combines several different modifications that can be applied to a method/function signature. You can use this refactoring to:
change the method/function name and return type
add, remove, and reorder parameters
change parameter names and types
change the visibility type (for Swift) and the callable type (for Objective-C)
When changing a method/function signature, AppCode searches for all usages of the method/function and updates all the calls, implementations, and override replacements of the method/function that can be safely modified to reflect the change.
Changing a method/function signature
Position the caret at the name of the method/function that you want to refactor.
Press ⌃ F6. Alternatively, select Refactor | Change Signature from the main or context menu. The Change Signature dialog opens.
In the Change Signature dialog, make necessary changes to the method/function signature depending on your needs:
For Objective-C: change the type of a callable procedure. In the Callable Type filed, select Function, Method, or Block.
For Swift: change the visibility type. In the Visibility field, select public, internal, private, or another type.
Change the method/function name. To change the name, edit the text in the Name field.
Change the method/function return type by editing the contents of the Return type field.
Manage the method/function parameters. To configure the parameters, use the table and buttons in the Parameters area:
To add a new parameter, click
and specify the new parameter's properties in the corresponding table row.
tip
Auto-completion is available when typing the parameter type.
To remove a parameter, select any row and click
.
To reorder the parameters, click
and
.
To see the expected changes and make adjustments prior to the refactoring, click Preview (available for Objective-C only) .
Click Refactor.