AppCode 2016.2.2 EAP: new completion features for Swift

Hi everyone,

This week brings new 2016.2.2 EAP with new completion features on board! Let’s take a look at them right now.

Closure completion

How often do you use closures in Swift? Well, it’s not the question for us :) And that’s why we decided to spend some time to implement proper completion for them.

Starting with this build simply press Enter on the closure argument placeholder in any function and have the closure stub generated for you:
Function closure parameters
Of course, for functions with a single closure parameter AppCode will use trailing closure syntax.

What if you have a closure as a variable in your code? The answer is simple: invoke completion and quickly generate the closure stub:
Closure variable
Note, that some issues related to this feature still exist and most of them are linked as related to this base ticket.

Completion and argument placeholders for Swift subscripts.

Swift allows you to create custom subscripts and you can make them as complex as you want. But even if you prefer to keep them simple, this small feature will be really helpful.

Imagine that you have two subscripts for the same class, like in Checkerboard struct here. Now you can select needed subscript from completion list and have placeholders for subscript arguments auto-filled:
Subscript placeholders

As usual, you can use Tab to jump between placeholders.

Let’s modify one of the subscripts and add external parameter names:

subscript(xCoord x: Int, yCoord y: Int) -> Square {
    get {
        return self[(x: x, y: y)]
    set {
        self[(x: x, y: y)] = newValue

Now AppCode will auto-fill external parameter names as required together with argument placeholders:
Subscript internal parameters

Finally, this build also makes internal parameter names available in completion list inside Swift functions, adds proper argument placeholders for Swift enum members and fixes the problem with tabbing inside closures.

That’s it! Download new AppCode 2016.2.2 EAP, give it a try and share you feedback in the comments section below. Note that this EAP build requires an active subscription (or you can start a 30-day evaluation period).

Your AppCode team
The Drive to Develop