AppCode 2020.2 Beta Brings Change Signature Refactoring for Swift!
AppCode 2020.2 release is just around the corner, and our first Beta build delivers an initial implementation of the Change Signature refactoring for Swift! Let’s take a closer look at it.
When you need to change the signature of a method, the usual flow is to rename all the method parts separately, such as parameter names, internal parameter names, and the method name itself. This already makes for too many repeated Rename refactorings.
But what if you need to also change the method return type, or the type for one of the method parameters? What if you need to also change the method visibility? The only way to do this is to go in and manually change the code. This is where the Change Signature refactoring comes in, helping us perform all these tasks at once, automagically.
⌘F6 or select the Change Signature refactoring from the Refactor this popup (
⌃T). If you are trying to change the signature of an overridden method, AppCode will ask if you want to change the base method together with overridden ones, or only the overridden method:
In the dialog that opens you can rename the method itself, change its visibility, change internal and external parameter names, and add or delete parameters:
You can invoke this refactoring from any method usage in the project – not necessarily from its declaration. When adding a parameter, specify its default value. Check Optional if you want it to be added to the method signature, or leave as is to insert the value to each method call:
What if you need to “just” reorder
init method parameters in the whole project? Press
⌥↓ in the Change Signature dialog:
Click OK to perform the refactoring, and AppCode will change all method occurrences in your project.
Your AppCode team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!
AppCode 2023.1 Bug-Fix Update
Hi, AppCode 2023.1 has just been released with fixes for Xcode 14.3 compatibility, Swift refactorings and intentions, the IDE’s UI, and Kotlin Multiplatform Mobile. On December 14, 2022, along with the AppCode 2022.3 release, we sunsetted the product and stopped sales. While we’ve refocused the te…
AppCode 2023.1 Release Candidate
Hi, On December 14, 2022, along with the AppCode 2022.3 release, we sunsetted the product and stopped sales. While we’ve re-focused the team's efforts in other directions, we’ve kept providing technical support to our current users and are releasing bug-fix updates in 2023, targeting mostly the Xco…
AppCode 2022.3 Release and End of Sales and Support
AppCode 2022.3 has just been released. With the release of v2022.3, we are sunsetting the product.
AppCode 2022.3 Release Candidate Is Here
Hi everyone, The release of AppCode 2022.3 is approaching, and the release candidate (build 223.7571.233) is now available for download on our website. You need to have an active subscription or activate a free trial to use this build. The main highlights of this build include: We fixed the r…