Swift is supported in CLion via the Swift plugin. With this plugin installed and enabled, CLion can be used as a fully-functional Swift IDE on Linux, macOS, and Windows (see this blog post for details).
Enable Swift support
Create a new Swift Package project
Go to Swift Package project type:and select the
Specify the project's name and package type (Executable, Library, or System).
The Swift version is detected according to the toolchain provided in .
Click Configure to open the settings dialog and change the path if required.
Swift support in CLion includes the following features:
Automatic resolve for project dependencies:
Swift Package Manager actions available from the menu:
Detecting and importing changes:
Code highlighting and completion in .swift files including completion for project targets in Package.swift:
Code generation Alt+Insert and refactoring Ctrl+Alt+Shift+T options:
Swift-specific code checks including SourceKit inspections (to configure the inspections, go to ):
Run/debug configurations for Swift
CLion automatically creates run/debug configurations for all products listed in the Package.swift file:
To create or edit configurations, go to thedialog:
You can run or debug such configurations using toolbar icons or by calling Run Anything (press Ctrl twice). All CLion debugging features will be available for your Swift configurations. To help you work in Swift LLDB console, CLion provides completion for the debugger commands.