AppCode 2020.3 Help

Swift packages

Swift packages are bundles of source files, binaries, and resources that you can reuse in your Xcode projects. In AppCode, you can work with Xcode projects that use Swift packages and run and debug Swift packages' code and unit tests.

All Swift packages and dependencies are available from the Project tool window:

SPM in the Project tool window

General code assistance features (completion, highlighting, and navigation) that you have in a regular Xcode project are available for Swift packages as well.

Edit the package manifest file

When editing the Package.swift file in AppCode, you can use the target name and path completion:

Target name completion in Packages.swift

Every time you edit the manifest file, the structure of the Swift Package Manager project changes, and you need to load these changes to AppCode. To do this, click the Reload SPM Changes in the top-right corner of the editor or press ⇧⌘I:

Load SPM changes

Run/debug code in Swift packages

If your Swift package has executable or test targets, you can run them using special run/debug configurations:

Swift Packages run/debug configurations

All Swift package's run/debug configurations that you have in Xcode are available in AppCode. Besides, you can create them from the Swift Package Run and Swift Package Test templates:

Create a Swift package run configuration

Resolve dependencies

Swift package dependencies are automatically resolved on project opening. You can also invoke this action by selecting Tools | Swift Package Manager | Resolve Dependencies from the main menu. This may be necessary when you need to download a remote Swift package dependency, or if you have changed the manifest file.

Last modified: 18 January 2021