finds.dev

nicklockwood/SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code

View on GitHub

★ 8,857SwiftMITupdated Jul 2026

// the take

SwiftFormat is a code formatter for Swift that goes further than whitespace: it can insert or remove implicit `self`, strip redundant parentheses, enforce trailing commas, and apply 50+ other opinionated transforms. It targets any Swift developer or team that wants formatting enforced automatically rather than debated in code review.

The rule set is genuinely broad — things like `redundantSelf`, `isEmpty`, and `hoistPatternLet` go well beyond what most formatters attempt, catching real style inconsistencies not just indentation. Integration options cover every realistic workflow: CLI, Xcode extension, SPM plugin, build phase, pre-commit hook, GitHub Actions, and Docker, so teams can enforce it wherever they trust. The `--infer-options` flag is a practical touch: point it at an existing codebase and it reverse-engineers a config that matches current style, which makes onboarding onto legacy codebases much less painful. The `Snapshots/` directory is used as regression test fixtures against real-world repos, which catches edge cases that unit tests on synthetic code miss.

The Xcode source editor extension can't read per-project `.swiftformat` files automatically — you have to manually import and re-import the config every time it changes, which means in practice most Xcode plugin users just run with global settings and silently diverge from the project config. The `--disable all` plus explicit enable pattern is the right escape hatch for locking down new rule opt-ins, but it's easy to miss: teams that don't know about it will pick up new rules on every SwiftFormat upgrade, causing unexpected diffs in CI. There's no semantic understanding of Swift — rules like `redundantSelf` can misfire in contexts involving property wrappers or closures with captures, and the workaround is a per-line disable comment rather than a fix. Windows support exists but is clearly a second-class citizen: no Xcode extension, no Homebrew, build-from-source only, and the WiX installer in `Platforms/Windows/` looks unmaintained.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
8,857
Forks
693
Language
Swift
License
MIT
Last commit
12 Jul 2026

// nearby

If SwiftFormat isn't quite it.

All repos →