Swift Project Management#

Noctule supports Swift Project Manager projects.

Creating a New SwiftPM Project#

To create a new Swift PM project, open the wizard with File → New Project… → Swift Package. Under the hood, Noctule executes swift package init to create the new project. The wizard provides a user interface to configure the settings passed to this command.

Options#

Name
The name of the project. It’s used by the IDE and is also serves as the default value for the package name input.
Location
The parent directory for the new project directory.
Swift Toolchain
Defines the default Swift toolchain for the new project. It is also used to execute the swift command to create the new project.
Swift SDK
Defines the default SDK for the new project. By default, no SDK is configured to use Swift’s defaults.
Package Type
The type of package to create. It’s passed as the value for --type of swift package init.
Package Name
The name of the package. If defined, it’s passed as the value for --name of swift package init.
Enable support for Swift Testing
Whether to enable support for Swift Tests. If enabled, --enable-swift-testing is passed to swift package init. Otherwise, --disable-swift-testing is passed. This option is grayed out if the selected Swift toolchain does not support it.
Enable support for XCTest
Whether to enable support for XCTest. If enabled, --enable-xctest is passed to swift package init. Otherwise, --disable-xctest is passed. This option is grayed out if the selected Swift toolchain does not support it.

Opening a SwiftPM Project#

You can just open the directory containing the Package.swift file in your IDE.

If you would like to work on several Swift projects at the same time, then open the parent directory containing all the projects.

Noctule will detect all Package.swift files inside the directory hierarchy and pass these directories to the Swift langauge server.

Opening an XCode Project#

macOS only

Using XCode projects is not fully supported yet by Noctule. Only macOS is supported for this workaround.

XCode projects are not officially supported yet. But there are workarounds to get at least basic support for Swift development.

xcode-build-server is used to integrate SourceKit LSP with an XCode project. Under the hood, Noctule uses SourceKit LSP to support some of the IDE features.

You need to install xcode-build-server and then run it to create the necessary setting files for your project.

# only needed if you haven't installed xcode-build-server yet
brew install xcode-build-server

cd ~/projects/my-xocde-project

# for more options, please refer to https://github.com/SolaWing/xcode-build-server
xcode-build-server config -workspace *.xcworkspace 

Now, you need to tell Noctule to treat the directory as a BuildServer project.