AppCode joins Swift club with 3.1 EAP
Most of us have read or at least heard of Gulliver’s Travels by Jonathan Swift. Well, we kind of feel like a Gulliver now, as we take a big step forward and start with Swift support in AppCode!
This summer, soon after the Apple event, we announced basic editing and highlighting for Swift code. Since then we’ve implemented resolve in Swift code and built a couple of useful features on top of that. So, let’s have a look at what’s already available in this EAP.
Start with creating a Swift-based project or just a new Swift file (select New | File from Xcode Template…) in the currently existing project. Now you can write some code, autocompletion for the language keywords will assist you with that.
After implementing the most part of resolve in Swift code, we are able now to provide you with smart features. Find Usages goes first! It helps you quickly find all pieces of code referencing a symbol at the caret, no matter if the symbol is a class, function, variable, constant, or type.
If you simply place a caret on a symbol in your Swift code, AppCode highlights all the usages within the current file and also marks them all in the right gutter:
If you are interested in the full list of usages, press
Alt+F7 to have AppCode find all usages for you and collect them in a separate window. You can group the usages there by your preferred criteria, for example by directory:
AppCode is known for its safe, accurate and reliable automated refactorings that allow you to modify and improve your code easily. With 3.1 EAP we bring the most widely used Rename refactoring to Swift code! Rename (
Shift+F6) variables, constants, functions, type names and classes and be sure AppCode updates all the usages across the entire code base for you:
Since this is a EAP build external function parameter names (as well as shorthand names) are not resolved and thus are not highlighted as usages or renamed when used outside the function body.
Navigation options help you switch quickly between parts of your code to be more productive. For Swift code, AppCode now supports:
- Go to Class (
- Go to Symbol (
- Navigate to declaration of symbol at caret (
AppCode provides more navigation options that are language-independent and thus work regardless of the Swift or Objective-C languages used in your project. Check them in Navigate menu or read the detailed descriptions in AppCode web help. By the way, web help is integrated into the IDE. In many dialogs now you can see a Help button that redirects you to the appropriate page in the web help.
Swift was created to be interoperable and compatible with Objective-C, so Swift API can be used in Objective-C and vice versa. In this EAP build, AppCode supports Objective-C-to-Swift resolve, which means that Swift classes can be resolved in Objective-C code. Hence, you can use completion, navigation and find usages functionality in these cases.
There are still a few important limitations in the current Swift functionality:
- AppCode doesn’t provide you with compile warnings in the editor.
- Completion is now working only for the keywords.
- Code formatter for Swift is not ready yet.
- External parameter names, shorthand names and tuple element names are not resolved correctly yet.
- While Swift classes are resolved correctly in Objective-C code, usages of methods are not; we plan to improve this in the nearest updates.
We’ll continue to enhance Swift functionality to deliver more goodies for you to use in the following updates.
We are committed to helping developers be more productive in all stages of their development process. Debugging is one of the steps where our IDEs can assist in a smart way. In this EAP we add a new helpful feature: Inline Variables View. It’s intended to show you the variable values right in the editor (next to variable declaration):
Inline Variables View is enabled by default, but can be easily switched off in Debug tool window | Settings menu | Show Values in Editor.
When you run this EAP build, you’ll definitely notice how the Preferences dialog has been redesigned. Settings have been rearranged, and the overall structure is clearer and more logical. Project-specific settings and IDE settings are now merged together. To tell if a setting relates to the current project, note the icon to the right of the setting’s name:
We’ve also followed up on one of the top voted users’ requests, and now you can sort files in project view “like in Xcode”. To use it, enable Manual Order in the context menu.
This EAP build brings a lot of small editor enhancements that all together provide users with better development experience. First, smarter Backspace key now removes indents and white spaces according to your code style settings:
This is enabled by default but can be easily switched off in Preferences | Editor | General | Smart Keys.
To keep specific formatting in some selected files, we provide you with a new option for keeping proper coding style by auto-detect and use existing file indents for editing. While opening a file with different coding style in AppCode, you’ll be able to retain indent sizes and other style settings and use these values for this particular file while reformatting your code. Feel free to switch it On or Off in Preferences | Editor | Code Style (it’s On by default).
Both features are applicable to all languages except Swift for now, since formatter in Swift is not ready yet.
Some other notable changes:
- Symbolic breakpoints are now available in AppCode.
- Find in Path improvements: starting with v3.0, AppCode allows you to search through comments and string literals. In 3.1 EAP, you can also search anywhere except any of these or except both.
- Git integration was updated with the Reset Current Branch to Here action in Git Log.
- Rollback action is now available for a code selection via Alt+Cmd+Z or left-gutter menu. It will revert the exact selected block but won’t touch other code containing changes.
Some performance enhancements and C++ improvements were also introduced. The full list of fixed issues can be found in our issue tracker. Please note that system requirements have slightly changed: the lowest supported OS X version is 10.9, and the lowest supported Xcode version is 6.1.
P.S. Continuing our code-naming tradition, these EAP builds will be dubbed Champurrado, which is a warm chocolate-based Mexican drink. Yummy! On the practical side, it’s also the easiest way to find information on specific AppCode versions in our blog: to find posts about v3.1, just search for Champurrado.
Develop with pleasure!
The AppCode Team