On this page
Overview
SwiftFormat is a Swift code-formatting library and CLI. Beyond whitespace, its rules can normalize implicit self, redundant parentheses, and many Swift idioms, while .swiftformat, lint mode, Xcode integration, SwiftPM plugins, and CI workflows automate a shared code style.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Pin formatting rules and options in .swiftformat
swiftformat . applies formatting rules to Swift files under a directory, while .swiftformat stores indentation, Swift-version, and rule configuration per project. --infer-options can suggest options based on existing source style.
Sources: [2]
Best fit
Fits Swift teams that want less style noise and more behavior-focused code review
It is useful when spacing, declaration layout, and other style differences should be automated and formatting violations should be caught in CI.
Sources: [2]
Before adoption
Formatting rewrites source files, so pin the version and inspect diffs
The README warns that swiftformat . overwrites matching Swift files and recommends consistent tool versions for shared projects. Version 0.63.1 adds deterministic sorting through --locale and multiple rule fixes; Package.swift uses Swift tools 5.7.
Official sources
- [1]nicklockwood/SwiftFormat — GitHub repository(2026-10-06)
- [2]SwiftFormat 0.63.1 — README(2026-10-06)
- [3]SwiftFormat 0.63.1 — Package.swift(2026-10-06)
- [4]SwiftFormat 0.63.1 release(2026-10-06)
- [5]SwiftFormat MIT license(2026-10-06)
Supplemental curator note
SwiftFormat fits teams that want automated Swift style and less formatting noise in review. Because formatting rewrites source files, pin the version, keep changes under source control, and use lint mode in CI.
Try it in 3 steps
- 1
Add SwiftFormat 0.63.1 as a SwiftPM dependency
Pin the formatter version used by the project and make SwiftFormatPlugin available.
.package(url: "https://github.com/nicklockwood/SwiftFormat", exact: "0.63.1") - 2
Define project rules in .swiftformat
Store the Swift version and indentation rules in the project-root configuration.
printf "%s\n" "--swiftversion 6.0" "--indent 2" > .swiftformat - 3
Run formatting through the SwiftPM plugin
Apply the formatter using .swiftformat. Commit or stash source changes first because formatting rewrites files.
swift package plugin --allow-writing-to-package-directory swiftformat
Growth
Growth trends · Last 30 days
8,928 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 18
- Open PRs
- 6
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Apache Maven5,369 Stars
2 shared tag(s) · 3 shared category(s)
Standardize Java/JVM builds by sharing dependencies, plugins, and lifecycle rules in a POM
Java - Appium22,046 Stars
2 shared tag(s) · 2 shared category(s)
automate end-to-end tests for Android, iOS, and desktop apps through WebDriver-compatible APIs
TypeScript - Allure Report5,549 Stars
2 shared tag(s) · 2 shared category(s)
turn results from multiple languages and test frameworks into unified reports with history, steps, and attachments
HTML - Renovate22,688 Stars
1 shared tag(s) · 3 shared category(s)
automate dependency discovery and update pull requests across 90+ package managers
TypeScript - Turborepo31,176 Stars
1 shared tag(s) · 2 shared category(s)
use task graphs and caching to run only the monorepo build, test, and lint work that matters
Rust - Nx29,392 Stars
1 shared tag(s) · 2 shared category(s)
Model project dependencies and run only the tasks that a change requires
TypeScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.