News

AppCode starts 2016.2 EAP: Swift inspections and Live Templates, improved Rename for the mixed code and more!

Hi everyone,

Today we are starting the Early Access Program for AppCode 2016.2 EAP, with a huge number of changes available in the very first build. You’ve waited for some of them for a long time, so check it out right now!

Swift

SourceKit inspections and intentions

This build brings one of the long-awaited features from our roadmap – initial implementation of inspections and intentions in Swift. Now AppCode shows warnings and errors for Swift code in the editor right as you write it!
Swift warnings and errors in editor

To display these warnings and errors, AppCode uses SourceKit engine bundled in the Xcode version selected in AppCode settings. Moreover, most quick-fixes available for Swift in Xcode can now be used in AppCode. Just press ⌥Enter on a warning or error and select Apply Fix-it:
Swift quick-fixes
In case of several fix-its suggested for a particular code block, AppCode will display their descriptions, allowing you to select the necessary action:
Multiple Swift quick-fixes
Inspection settings are available under Preferences | Editor | Inspections | Swift | SourceKit inspections, where you can turn it on or off at any time:
Intention settings
SourceKit inspections are also available in batch mode, and here you can fix every problem step by step. For now it’s even easier with improved UI for code inspections available in this version:
Batch mode

Live Templates

Live Templates in AppCode are similar to Xcode snippets. They contain predefined code fragments so that you can use them to insert frequently-used or custom code constructs into source code quickly. Starting with this build, Live Templates are also available for Swift language:

  • Invoke a Live Template by typing its abbreviation, or use ⌘J and select it from the list:
    Live template calls
  • Quickly iterate collections with the smart for template:
    For template

You can also add your own custom Live Templates for Swift under Preferences | Editor | Live Templates | Swift. Select predefined code context to make your live templates available only for Swift declarations, statements or any code construction:
Live templates context

Spelling inspection

In addition to the SourceKit inspections mentioned above, we decided to make the Spelling inspection available for Swift language. If you happen to mistype something in your comments or code constructs, AppCode will underline the misspelled word. Then you can fix the problem simply by pressing ⌥Enter:
Spellchecking

Recursive resolve for shorthand arguments in closures

This feature had one of the shortest descriptions in our tracker, one simple line:

let a = {$0 + 1}

Nevertheless, it was a huge task we needed to finish as part of preparation for creating Introduce Variable and Inline Variable refactorings for Swift. This build contains an initial implementation of recursive resolve for closures in Swift, including correct resolve for shorthand arguments. This change brings the following features:

  • Now you can benefit from completion for shorthand arguments:
    Shorthand completion
  • In case the closure contains tuple as parameter, you can navigate to the actual declaration of the tuple item:
    Navigation

Please note that some issues with closure resolve still exist; most of them are added as sub-tickets to the base task. We will continue to work on them and will try to resolve the most important ones before the 2016.2 release.

Mixed code improvements

It’s been awhile since we implemented the Rename refactoring for pure Swift code and Objective-C declarations used from Swift. Now we add the ability to rename Swift methods and method parameters used from Objective-C code! Let’s take a quick look at it:

  • If using Swift methods from Objective-C, you now can invoke Rename on the method name:
    Rename Swift from Objective-C
  • To rename external or local parameters, invoke Rename from Swift code:
    Rename Swift parameters
    Notice how Objective-C representation was correctly updated in Objective-C code.

Another great addition in this build is improved Find Usages (⌘F7) functionality, which now also finds occurrences of Swift methods used from Objective-C, including initializers.

There are also lots of fixes for code declarations annotated with @objc attribute, bringing improved parsing and highlighting for classes, protocols and enums, and correct resolution for properties, subscripts, getter and setter names.

Objective-C/C++

Doxygen support

You may know that AppCode and CLion teams work together to bring you first-class C++ support in both products. But sometimes C++-related features also intersect with Objective-C, and one such feature recently implemented by the CLion team is initial support for Doxygen. For now, the same features are available for C++ support in AppCode and some of them have already been added for Objective-C as well:

  • You can now benefit from completion for Doxygen-style commands in Objective-C comments:
    Doxygen commands
  • The formatting for Quick Documentation (F1) is significantly improved with proper rendering for all Doxygen-style comments:
    Quick documentation

Please note that because of some issues, automatic comment generation for Objective-C is not yet included into this build, but we will try to deliver this feature before the 2016.2 release.

Complete statement

With Complete Statement (⇧⌘Enter) feature added in this build for Objective-C and C++, AppCode inserts parentheses, braces, semicolons, quotes, etc. for you where necessary, and then moves the caret in position where you can start typing the next statement automatically. The simplest example can be just adding a semicolon, but even this small feature can be helpful in case of complex code constructions:
Complete statements

Read this blog post to learn more about it.

Debugger

In debugger tool window, the Watches and Variables modes are now merged so you don’t need to switch between them. If you still prefer the old style, a new button is available in the watches toolbar to switch between the modes (new mode is on by default):
Debugger

VCS improvements

The following changes are available for VCS support in AppCode:

  • To make navigation through the VCS log easier, we’ve added tooltips with target commit information for arrows:
    Tooltips for commits
  • Commit dialog now also shows unversioned files:
    Unversioned files
  • Support for Apply somehow interactive mode for applying patches.
  • Git/Hg log shows commit details for several selected commits.

Phew, that does it! Full release notes for this build are available here. This being an EAP for a major update, the build does not require an active license so you can use it free for 30 days.

Download AppCode 2016.2 EAP, give it a try and let us know what you think!

Your AppCode Team
JetBrains
The Drive to Develop