Swift

AppCode provides Swift developers with essential coding features like code highlighting, which makes code easier to read; code formatting following a pre-defined or user-specific code style schemes, which describe indents, various spaces, blank lines; and much more.

Refactorings

Rename refactoring

Rename

Rename Swift variables, constants, functions, type names and classes with Rename refactoring and rest assured that AppCode will update all the usages across the entire code base for you.

If using Objective-C classes from Swift, get them correctly renamed as well. When using Swift methods from Objective-C, you can rename class names, method names, external and local parameters, even taking into account alias names for Objective-C entities.

Extract Variable refactoring

Extract Variable

With the Extract Variable refactoring for Swift, you can easily extract a part of a complex expression into a local variable, and take advantage of automatic suggestion for the variable name, options for automatic type specification, and making your variable mutable or immutable.

Try writing your expressions first and rely on AppCode suggestions for the variable name and type – time savings are guaranteed.

Extract Method refactoring

Extract Method

Easily extract methods and functions from your Swift code just by pressing ⌥⌘M, and have the signature suggested automatically together with parameter names.

Code generation

Override/Implement

Override/Implement

Easily override/implement multiple methods of the parent class or protocol in your Swift code with the Override/Implement

Live Templates

Live Templates

Use Live Templates to generate predefined code blocks and constructions and quickly surround your Swift code constructs using Surround With templates.

Learn more about Live Templates in this tutorial.

Create from Usage

Create from usage

Easily create types, variables, functions and properties from usage. Write the signature of a non-existing function (class method or the global one) when prototyping your code, invoke ⌥⏎ and have its declaration created automatically:

Code style

AppCode comes with a first-class set of Swift formatting options allowing you to easily reformat your code.

Set your preferred formatting options for closures, chained method calls, condition clauses or function parameters, define the wrapping behavior, and stop caring about spaces and indents when writing your code.

Inspections & Intentions

Swift inspections and intentions

SourceKit inspections

With the SourceKit inspections integrated, warnings and errors for Swift are displayed right in your editor window. AppCode shows the same fix-its as Xcode does and helps you to fix the problem simply by pressing ⌥⏎.

Spelling inspection for Swift

Spelling inspection

If you happen to mistype something in your comments or Swift code constructs, fix it simply by pressing ⌥⏎, as Spelling inspection is integrated in AppCode.

Completion

Basic completion

Completion for basic types, methods, variables and closures also works for Swift code, supporting CamelHumps and Middle Matching.

Autocompletion fills out method and function parameter names and value placeholders and helps you write code faster and easier.

Closure completion

Closure completion helps you generating code for closure variables and trailing closures in methods and functions.

Override/Implement completion

Override/implement completion helps you in overriding or implementing methods and properties.

Completion for subscripts

Subscripts in Swift may contain multiple parameters – that's why AppCode makes it easier for you to deal with them by filling the corresponding placeholders.

Navigation & Search

Navigation example

Navigation options like highlighting all usages, navigation to symbol declaration, go to class/symbol, Search Everywhere action and File Structure view work for Swift code as well. You can also list all usages in a separate window and group them the way you prefer with the Find Usages action.

Documentation

Quick Documentation

AppCode shows you the relevant documentation for Swift language. Press F1 to bring up a window with clickable links to other resources.

Quick Documentation for Swift can include: standard documentation from Apple DocSets, your own documentation comments, classes, protocols and functions signatures, enums, type aliases, etc., and even inferred type for constants and variables.

Debugger

Evaluate Expression

AppCode uses LLDB paired with the Xcode you select in the IDE settings.

View variables added to Watches tool window, evaluate Swift expressions using Evaluate expression (⌥F8) and benefit from code completion for both cases.

Set Value

Change values of type properties, arrays and array elements, and even Core Data objects without stopping your debugging session with the Set value action (F2).

Inline variables view works for Swift as well.