EVERYTHING XIAOMI
Get listed

swift-format

swift-format is a free, Apache-2.0 licensed tool for formatting and linting Swift source code.

Place
#15 of 34
Score
6.2
swift-format's website

What swift-format is

swift-format is a free, Apache-2.0 licensed tool for formatting and linting Swift source code. Its format command processes one or more files or code received through standard input. The lint command checks files for style violations and writes diagnostics to standard error. A JSON configuration file adjusts supported behavior, and the tool searches parent directories for a .swift-format file. Swift applications can use the SwiftFormat package module, including SwiftFormatter and SwiftLinter APIs. Swift Package Manager plugins provide formatting and linting commands, and the project supplies formatting technology for SourceKit-LSP. Installation is documented through the Swift toolchain, Homebrew, or source builds. The README says Swift 6, included with Xcode 16, and later include swift-format in the toolchain. Earlier versions may not recognize newer syntax. The project presents its style as experimental rather than a proposed default.

Good

  • Formats files or standard input
  • Lint diagnostics go to standard error
  • JSON configuration supported
  • Swift Package Manager plugins included
  • Apache-2.0 open-source license

Watch out

  • Earlier versions may miss newer syntax
  • No default Swift style is proposed
  • Installation may require building from source

Who it suits

It suits Swift developers who need command-line formatting, lint checks, package plugins, or library APIs. It is also relevant for SourceKit-LSP integrations.

Verdict

swift-format provides formatting and linting through commands, plugins, APIs, and SourceKit-LSP technology. Its compatibility depends on matching the tool version with the Swift syntax in use.

Plans and prices

From swift-format's own pricing page, checked 11 Oct 2026.

All about pricing
PlanPriceWhat it gives you
swift-formatFreeApache-2.0 licensed · available via Swift toolchain, Homebrew, or source

The facts

Each one read from swift-format's own pages, with the date it was checked.

What it does

Configuration
Users can customize supported behavior with a JSON configuration file, and the tool searches parent directories for a .swift-format file.checked 11 Oct 2026
Formatting
Its format command formats one or more Swift source files or source code read from standard input.checked 11 Oct 2026
Install options
The project documents installation through the Swift toolchain, Homebrew, or building from source.checked 11 Oct 2026
Integrations
swift-format provides formatting technology for SourceKit-LSP.checked 11 Oct 2026
Language compatibility
Earlier swift-format versions may not recognize syntax added in later language and parser versions.checked 11 Oct 2026
License
The repository identifies its license as Apache-2.0.checked 11 Oct 2026
Linting
Its lint command checks Swift files for style violations and prints diagnostics to standard error.checked 11 Oct 2026
Operating systems
The README documents using the tool through the Swift toolchain and Homebrew and building it from source; it does not specify operating system support on that page.checked 11 Oct 2026
Purpose
swift-format provides formatting technology for Swift source code and building blocks for code formatting transformations.checked 11 Oct 2026
Style caveat
The project says no default Swift code style guidelines have yet been proposed and describes its current style as one possibility for experimentation.checked 11 Oct 2026
Swift API
Swift applications can use the SwiftFormat package module, including SwiftFormatter and SwiftLinter APIs.checked 11 Oct 2026
SwiftPM plugins
The package provides Swift Package Manager command plugins for formatting and linting source code.checked 11 Oct 2026
Toolchain inclusion
The README says Swift 6, included with Xcode 16, and later include swift-format in the toolchain.checked 11 Oct 2026

Alternatives to swift-format

All alternatives
  1. 1Prettier logo

    Prettier

    Free planOpen sourceWebAPIExtensionLinux
    7.5Free plan
  2. 2

    Avidemux

    Free planOpen sourceWebLinuxmacOSWindows
    7.3Free plan
  3. 3

    Fourmolu

    Free planWebLinuxWindows
    6.7Free plan
  4. 4

    rustfmt

    Free planLinuxmacOSWindows
    6.6Free plan
  5. 5

    Black

    Free planLinuxmacOSSelf-hostedWindows
    6.5Free plan
  6. 6Ruff logo

    Ruff

    Free planWebLinuxmacOSSelf-hosted
    6.5Free plan