AppCode News

Swift on Windows in CLion

Hi,

You may have heard that Swift is now available on Windows. We’ve been following this development closely, and we’ve decided to make it possible to use the Swift plugin in CLion on Windows. It’s now available in CLion 2021.1 EAP (211.6556.10). Let’s take a look!

Prerequisites

Install all the required and recommended components from the official Getting Started guide (note that you need the Swift 5.4 toolchain for Windows).
Add the following items to the system PATH variable:

  • %SystemDrive%\Program Files (x86)\Microsoft Visual Studio\Shared\Python<version> (required for lldb and swift REPL)
  • %SystemDrive%\Library\Developer\Platforms\Windows.platform\Developer\Library\XCTest-development\usr\bin (required for XCTest)

Grant your user the “Create symbolic links” permission in the local security policies using this guide (see this forum thread for details).

Finally, run CLion with the Swift plugin installed and create a sample project.

Indexing

The initial indexing can take a long time, since we have no caches bundled for Swift toolchains on Windows. Subsequent indexing should be much faster.

Debug

Debugging does not currently work because of several lldb issues (such as SR-14243). We hope that they will be fixed soon and we will be able to add debugging support in the future.

Build and run

You can build and run your project on Windows in CLion just as you would on Linux or macOS:

Run SPM project

Run configurations are created automatically, and test configurations also work.

Code Assistance

Code assistance works just like it does on macOS and Linux:

Code assistance

That’s it for now! Stay tuned and keep an eye on this ticket (and related ones) for further updates.

Your AppCode team
JetBrains
The Drive to Develop