# SwiftFormat

> A command-line tool and Xcode extension for formatting Swift code

Source: https://talira.ai/catalog/swiftformat-bhqc4a74
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool, Library
- Categories: [developer tools / formatting](https://talira.ai/categories/developer-tools/formatting), [languages / swift](https://talira.ai/categories/languages/swift)
- Platforms: macos, linux, windows, docker[^3]
- Licence: MIT[^4]
- Pricing: Free and open source[^4]
- Free tier: yes[^4]
- Backed by: [Nick Lockwood](https://talira.ai/orgs/nick-lockwood.md)

SwiftFormat is a code library and command-line tool that reformats [Swift](https://talira.ai/catalog/swift-05qrpmw7.md) code on macOS, Linux and Windows. Beyond whitespace, its 150-plus rules insert or remove implicit self, remove redundant parentheses and fix many other departures from standard Swift idioms. It runs as a CLI, an [Xcode](https://talira.ai/catalog/xcode-yrayr0fd.md) source editor extension, an Xcode build phase, a Swift Package Manager plugin, a Git pre-commit hook, a Docker image or a GitHub Actions step, and its --lint mode checks code against the same rules in CI without changing it. Options can be kept in a .swiftformat config file.

## Links

- Website: https://swiftformat.info/
- GitHub: https://github.com/nicklockwood/SwiftFormat
- Docs: https://swiftformat.info/rules

## Ways to install

### Package managers

- [Homebrew](https://talira.ai/catalog/homebrew-djy17yn9.md): <https://formulae.brew.sh/formula/swiftformat>[^1]
- [mise](https://talira.ai/catalog/mise-0axr08xw.md): <https://mise-versions.jdx.dev/tools/swiftformat>[^2]

## Problems it solves

- format my Swift code automatically to one consistent style
- enforce a Swift code style on every pull request in CI
- reformat Swift files in Xcode on save or with a menu command

## Features

- over 150 formatting rules, each documented
- Xcode source editor extension and build phase
- Swift Package Manager plugin
- lint mode for CI with GitHub Actions log reporter
- .swiftformat config file and per-line disable comments
- Docker image and prebuilt binaries

## Limitations

- Some rules can change behaviour or break compilation in edge cases (enumNamespaces, redundantType, preferKeyPath and others), as its known issues list says[^3]
- Releases are no longer published to CocoaPods since version 0.64.0[^3]
- In Xcode 15 or later, the build phase needs User Script Sandboxing turned off[^3]

## Trust

Overall: 0.70 out of 1.
Signals: maintenance 1.00, adoption 0.79, momentum 0.56, community 0.95, backing 0.30, extensibility 0.00.

- last commit 15 days ago
- 208 commits in the last 90 days
- latest release 0.64.7 15 days ago
- 9.0k GitHub stars
- 234 contributors
- 12k Homebrew installs in 30 days
- backed by Nick Lockwood

## Related

- Works with [Xcode](https://talira.ai/catalog/xcode-yrayr0fd.md)

## Alternatives

- [Airbnb Swift Style Guide](https://talira.ai/catalog/airbnb-swift-style-guide-3arvn83b.md): Airbnb's Swift style guide, with a SwiftPM plugin that formats and lints to it

## Sources

[^1]: https://formulae.brew.sh/api/formula.json (checked 27 Nov 2026)
[^2]: https://mise-versions.jdx.dev/tools.json (checked 27 Nov 2026)
[^3]: https://github.com/nicklockwood/SwiftFormat/blob/main/README.md (checked 27 Nov 2026)
[^4]: https://github.com/nicklockwood/SwiftFormat/blob/main/LICENSE.md (checked 27 Nov 2026)
