// plugins

Swift Plugin

Adapter plugin that formats Swift code via bundled SwiftFormat.

Formats .swift files on macOS and Linux (x86_64 and aarch64).

This is a process plugin. Using this will cause the CLI to download, run, and communicate with a separate process that is not sandboxed (unlike Wasm plugins).

Install and Setup

In your project's directory with a dprint.json file, run:

dprint add drluckyspin/swift

This will update your config file to have an entry for the plugin. Then optionally specify a "swiftformat" property to add configuration:

{
  "swiftformat": {
    "swiftVersion": "5.9"
  },
  "plugins": [
    "https://plugins.dprint.dev/drluckyspin/swift-vx.x.x.json@<checksum>"
  ]
}

Update to the latest release with dprint config update.

Configuration

See the plugin repository for configuration options and the JSON schema:

You can also keep a .swiftformat file in your project. The plugin passes --stdinpath so SwiftFormat discovers it automatically.