AppCode 2016.3: Swift 3 support, new formatting settings, performance improvements, and more
Hi, Habr!
Recently AppCode 2016.3 was released, and in this post we will tell about the most interesting changes in it.
Swift
Swift 3 support
One of the main tasks that we worked on in this release was support for Swift 3. We managed to accomplish a lot , and continue to work on the remaining tasks in future updates.
')
Create from usage
In each new update, we are trying to expand the possibilities of code generation for Swift. These include Live Templates , including those that allow you to “wrap” a dedicated section of code, and Introduce Variable refactoring, and Override / Implement ( ^O / ^I ), which can be used to generate definitions for several methods at once.
In this release, we added the ability to create variables, functions, methods, and even class properties from their uses. This is especially convenient if you need something to quickly prototype. Suppose there is no method yet, we write it, pass the necessary arguments, call ⌥⏎ - and that's all, it remains only to slightly correct the automatically generated function signature, if necessary:
As seen on the gif, using the same principle, you can create other entities in the code. We plan to add a similar opportunity for generating types (classes, structures, etc.) for Swift a bit later. But in Objective-C / C / C ++ all these features have been around for a long time, and you can and should use them right now.
Code formatting
For Objective-C / C / C ++, AppCode has a lot of formatting options:
You can apply them by calling ⌘⌥L on a dedicated part of the code (and if the code is not selected, the entire file will be formatted). The basic features for Swift were implemented as early as version 3.1 , while many language-specific formatting options were not among them. In this release we decided to add them.
Now in AppCode you can configure various transfer rules for:
Closure parameters
Simple closures in various cases of their use in the code:
Parameters in the declarations of methods and functions
Arguments of methods and functions used in code
Sequential method calls:
Multiple conditional constructions on the same line
Also added a block for spaces before and after the colons in the specifications of the types of variables, dictionaries and “key: value” pairs in the dictionaries themselves:
Speed performance
We improved the performance of the AppCode when working with Swift in several main areas.
The first is type inference. The code highlighting speed, autocompletion rate, and much more depend on it in AppCode. As a result, even for complex code constructions, it was significantly accelerated.
The second is the auto-completion rate. Here we thoroughly worked on caching the list of options, which made it much faster.
We also managed to fix several problems with SourceKit integration, which affected the speed of displaying errors, warnings and fixes (fix-it).
UI tests
Now in AppCode, you can run ( ^⌥R ) and debug ( ^⌥D ) UI tests. Fallen tests can be filtered from the passed ones and after restarts only restart them:
Test run results can be sorted by duration (or by name):
All of them are saved in the built-in history, and later you can view them directly in the IDE:
Semantic highlighting
Like in many other JetBrains products, AppCode now has the ability to highlight parameters of functions and variables with unique colors. You can enable it for Swift / Objective-C / C / C ++ in the settings of the Editor → Colors & Fonts → Language Defaults → Semantic highlighting :
C / C ++
By tradition, improvements in C / C ++ support implemented by the CLion team are also available in AppCode. You can read about them in this post in the sections Support C and Support C ++ , respectively. By the way, various platform changes (such as improvements in support for version control, San Francisco as the default font in the menu, and others) described in this post are also available in the AppCode.
Demo
A small demo (in English) with a demonstration of new features from our developer lawyer Phil Nash:
Read about other features of the product on our website , stay tuned to our English-language blog , and ask any questions you may have in the comments to this post.