AppCode 2016.2 Help

Completing Statements

On this page:

Completing statements

The Smart Enter completion enables you to create syntactically correct code constructs.

This command inserts necessary syntax elements (parentheses, braces, semicolons etc.) and gets you in position where you can start typing the next statement.

To automatically complete a statement, follow these steps:

  • Start typing a statement, and press ⌃⇧⏎.

    A construct element required in the current context is added and the caret moves to the next editing position.


The command is helpful in numerous scenarios, including auto-closing parentheses, adding semicolons, and more.

Complete Statement works with the following language constructs:

  • Type and type members: class, namespace, enum and enum classes.
  • Statements: if/else, while, do, for, switch/case, catch.

Below, you can find a number of examples of applying the complete statement command in different contexts.

Use caseBefore Complete StatementAfter Complete Statement
Class declaration
public class Foo /*caret*/
public class Foo { /*caret*/ };
switch clause
switch (/*caret*/) {}
switch (i /*caret*/ {}
switch (i) { /*caret*/ }
while statement
while (/*caret*/) {}
while (n > 0/*caret*/) {}
while (n > 0) { /*caret*/ }
if statement
if (/*caret*/) {}
if(n > 0/*caret*/) {}
if (n > 0) { /*caret*/ }
for statement
for /*caret*/
for (/*caret*/) {}
for (int i = 0/*caret*/) {}
for (int i = 0;/*caret*/) {}
for (int i = 0; i < 10; ++i/*caret*/) {}
for (int i = 0; < 10; ++i) { /*caret*/ }
Catch statement
@catch (/*caret*/) {}
@catch (NSError* error/*caret*/) {}
@catch (NSError* error) { /*caret*/ }

See Also


Last modified: 5 December 2016