Swift Package Manager support in CLion

Stanislav Dombrovsky

Hi everyone,

Today we are excited to announce that the Swift plugin for the latest CLion 2018.3 EAP build supports Swift Package Manager projects directly! Simply open the SPM project and work with it – no additional configuration required.

Read on to learn about all the available features, or watch the short demo below to see them in action:


Have all project dependencies resolved automatically:
Edit Package.swift with code completion and highlighting available:
Add dependencies easily with a code completion for project targets:
Target completion
Import changes in one click:
Invoke Swift Package Manager actions right from the context menu or via Tools | Swift Package Manager:


Code faster using the same code generation and refactoring actions that you have in the latest AppCode EAP:

Have SourceKit inspections and fix-its displayed right in your code editor:

Run, Debug, Test

Run Configurations are created automatically for all products in your Package.swift:
Run Configurations

To Run or Debug your application or tests, select the corresponding Run Configuration and press ⌃R or ⌃D:
Run and Debug

Linux support

Develop your SPM projects on Linux having almost the same features as on macOS:

Linux support

Please note that LLDB in Swift 4.1.x toolchains does not work correctly on Linux, so we recommend using Swift 4.2 toolchains. In addition, we have an issue when it’s not possible to Run or Debug all tests on Linux.

Future plans

During the 2018.3 EAP cycle, we plan to focus on fixing bugs and implementing such features as first-class unit-testing support, on the same level AppCode already offers for macOS. Other features are linked here as subtasks. After finishing most of these tasks, we plan to add support for Swift Package Manager projects in AppCode.

Here’s hoping CLion will become your IDE of choice for cross-platform Swift development!

Your AppCode Team
The Drive to Develop

Comments below can no longer be edited.

28 Responses to Swift Package Manager support in CLion

  1. Impressed Developer says:

    October 5, 2018

    This looks spectacular, and a game changer for Swift on Linux. To confirm, is SPM being used as the project model here? There’s no CMake in the picture at all?

    • Vyacheslav Karpukhin says:

      October 5, 2018

      Correct, CMake is not used for Swift in CLion anymore.

      • A says:

        October 5, 2018

        This is fantastic!

  2. Ian Partridge says:

    October 5, 2018

    Congratulations, this looks great!

    Do you plan to support running Swift projects on Linux in the macOS version of CLion, via Docker?

    • Stanislav Dombrovsky says:

      October 5, 2018

      In fact, it’s already supported. We plan to cover it in the next blog post about the server-side features. A quick example:

      1. Preferences | Plugins – install the “Docker integration” plugin from our plugin repository.
      2. Restart CLion
      3. Setup the docker instance in Preferences | Build, Execution, Deployment | Docker
      4. Checkout the Kitura Sample
      5. Load it in the CLion, wait for all the import / cache steps to be finished
      6. Copy patch contents and apply them via VCS | Apply Patch from Clipboard…
      7. Select the “Docker” Run Configuration and run.

      CLion should deploy the Docker container and start Kitura application inside (mapped to the http://localhost:8080 on the host machine).

      About other features:

      • Requests testing = ⌘N → HTTP Request
      • Database support = View | Tool Windows | Database
      • HTML/JavaScript/CSS support is bundled by default
      • Markdown = Preferences | Plugins → Install Markdown support
      • Handlebars/Mustache = Preferences | Plugins → Handlebars/Mustache
      • FTP/SFTP = Preferences | Build, Execution, Deployment | Deployment (short feature description here)

      Also, this article shows how to use Live Templates, File Templates, File Watchers plugin, and other functionality to setup integration for almost any command-line tool, Stencil files and more. It’s about Sourcery in AppCode, but the same principles can be used for making a custom setup

      • Ian Partridge says:

        October 8, 2018

        Fantastic, thanks!

  3. Nicolas Da Mutten says:

    October 11, 2018

    Looks great!
    However, I can’t get my Vapor project to build. It just is “Building…” forever… Executing “swift package build” works fine though. Are there any limitations?

    • Stanislav Dombrovsky says:

      October 11, 2018

      There are no limitations. Have you used the previous plugin based on the CMake with this project before? If so, please delete .idea folder first and try loading the project again. If it won’t help – could you please share your project with us, so we could check it on our side?

      • Nicolas Da Mutten says:

        October 11, 2018

        No, I developed it with Xcode and cloned it anew. It didn’t work on macOS Mojave and Ubuntu 18.04.

        You can find it here https://git.damutten.ch/Nicolas/HomeControl

        • Nicolas Da Mutten says:

          October 11, 2018

          I forgot to mention: in order for it to compile, you need to implement a struct, that implements the CredentialProvider Protocol and of course all its mentioned protocols too.

          • Stanislav Dombrovsky says:

            October 11, 2018

            Do you mean an actual Build via ⌃R or “Building symbols…” stage after opening the project? For the first time, it can be not fast, since we need to build caches for the project to use for all the code assistance actions. Subsequent loadings should be significantly faster. Run and Debug actions (as well as code highlighting, navigation and other code assistance actions) can’t work until we have all the caches.

            I’ve tried loading your project on macOS and it works after about 1-2 minutes of waiting for caches to be built (after all packages are downloaded). Could you please delete the .idea folder inside the project, try loading it again and wait until all the caching steps are finished – say, during 5 minutes?

          • Nicolas Da Mutten says:

            October 11, 2018

            Ah, it seems that I didn’t wait long enough before first building it.
            I however have another Problem now, but it seems to be a Problem in Vapor: DirectoryConfig.detect() does not work correctly, since it seems to assume some things…

            Th result is, that it does not find my Leaf Templates…

            • Stanislav Dombrovsky says:

              October 11, 2018

              Looks like it’s because of this issue. Workaround:

              1. Select “Edit configurations” in the Run Configurations popup
              2. Set the “Working directory” to the project folder with Package.swift.

          • Nicolas Da Mutten says:

            October 11, 2018

            Right! Workaround worked!

            I’m probably gonna push that PR 😉

            • Stanislav Dombrovsky says:

              October 11, 2018

              I’ve just moved it to the correct repository, so consider this one.

  4. Tabor Kelly says:

    October 31, 2018

    Could you explain how to install Swift support on Linux in clion-183.4139.25? I don’t see any Swift support here.

    • Tatiana Shabaeva says:

      November 1, 2018

      Hi Tabor, Swift plugin needs to be updated and checked internally, after that it’ll be published (likely tomorrow or early next week). Please use previous CLion EAP (build 183.3975.20) in the meantime, sorry for inconvenience.

  5. Satish Babariya says:

    November 26, 2018

    Are you planning to support Swift Using SourceKit-LSP (https://github.com/apple/sourcekit-lsp)
    If it is then it would be fantastic, Also if Jetbrains decides to create StandAlone Swift IDE then its also be awesome.

    • Stanislav Dombrovsky says:

      November 26, 2018

      Are you planning to support Swift Using SourceKit-LSP (https://github.com/apple/sourcekit-lsp)

      We already have almost everything listed as “not implemented” in SourceKit-LSP implemented in our plugin. And everything that is implemented also works in this plugin. Not clear, why should we add it, if we already provide the same features and even more.

      If it is then it would be fantastic, Also if Jetbrains decides to create StandAlone Swift IDE then its also be awesome.

      CLion = standalone Swift IDE for Swift Package Manager projects for macOS and Linux. So, it’s already here for a long time.

      • Tabor Kelly says:

        November 26, 2018

        But 2018.3, the first stable version to support SPM, still isn’t released. Right?

        So everything you wrote might be true soon, but is surely hasn’t been “already here for a long time.”

        • Stanislav Dombrovsky says:

          November 27, 2018

          2018.3 is the first version supporting SPM directly, without the CMake wrapper. But with the CMake most of these features worked before – yes, with some problems in the resolve/navigation/highlighting, but it also worked. And it had more features implemented if we compare to the current LSP state.

  6. Tabor Kelly says:

    February 4, 2019

    I downloaded and install CLion 2018.3 and it is *so close* to being usable. Unfortunately, SR-7932 (https://bugs.swift.org/browse/SR-7932) breaks debug of “system modules” on Linux.

    • Stanislav Dombrovsky says:

      February 4, 2019

      Hopefully, it will be resolved somewhen. Unfortunately, we do not have resources to contribute to the Swift language itself so we cannot fix it.

  7. TheIndifferent says:

    February 24, 2019

    Will SPM support be added to AppCode? Now it seems like CLion has way more functionality than AppCode, when would one choose AppCode instead of CLion?

    • Stanislav Dombrovsky says:

      February 25, 2019

      We will add it to one of the future releases. Adding another project model to AppCode is a big task, but we are working on it to deliver not only the Server-Side Swift, but also the first-class Kotlin/Native support.

  8. @chnmrc says:

    January 26, 2020

    How I can pass -Xcc -I include search path directive to the clion build process?

    • Stanislav Dombrovsky says:

      January 27, 2020

      CLion only invokes swift build when building SPM project, so any compiler options should come from Package.swift. AFAIK it’s not possible to add them to Package.swift now.

  9. David Robertson says:

    March 16, 2020

    We seriously don’t have this in AppCode yet? In fact it’s not even possible to edit files in a swift package in AppCode at all unless you have an xcodeproj for it. Which means I can’t use it at all just now.


Subscribe to product updates