Find dead code in Swift. See why it is dead.
Lethen reads the compiler's index store, so it sees what the compiler sees. Every finding is certain or likely, with the reference chain to prove it.
brew install albovsky/tap/lethenOther ways to installRead the guide
macOS 15 or later (Apple silicon) and Linux. Swift 6.3 or later. MIT licensed.
$ lethen scan --verbose Sources/Store.swift:12:10: warning: Unused function 'reload()' reason: no references in the scanned modules Sources/Cache.swift:40:7: warning: Unused class 'LegacyCache' reason: only referenced by unused code Sources/Bridge.swift:8:16: warning: Unused property 'tag' confidence: likely reason: Objective-C could reach this by name 3 results, 1 likely. $ lethen explain Store.reload Store.reload() is unused: certain. No declaration in the scanned modules references it.
How it works
A result tells you why
likely means something dynamic, such as Objective-C or a name in a string, could still reach the declaration.
Gate CI on what Lethen is sure about
$ lethen scan --min-confidence certain --strict
Add --write-baseline once, and later scans report only new results.
Ask why something is used or unused
$ lethen explain Store.load
Output as xcode, json, csv, github-actions or gitlab-codequality.
Features
Built for real projects
SwiftPM, Xcode and Bazel, with the configuration you already have.
Confidence and reasons
Every result is certain or likely, with a reason. --min-confidence lets CI fail only on what Lethen is sure about.
lethen explain
The shortest reference chain, or the rule that retained it.
Objective-C aware
Swift called from a .m file counts as used.
SwiftPM, Xcode, Bazel
Managed scans, or your own index store with --skip-build.
Never reads a stale index
A build is reused only when its index verifies; otherwise it rebuilds.
GitHub Action and plugin
Annotates unused code on pull requests. A SwiftPM plugin runs the same scan.
Periphery compatible
Your configuration, ignore comments and library name keep working.
Periphery's engine, improved results. Fewer false positives, a confidence level and a reason on every finding.
Accuracy
Measured in the open
Every analysis change re-scans pinned open-source projects, and each changed finding is checked by hand.
81 sampled findings across Alamofire, swift-nio and Wikipedia iOS. The target is 95 %. The first measurement, on 2026-09-27, was 73 %.
By project, against the target
95 % target. Samples: Alamofire 30, swift-nio 25, Wikipedia iOS 26.
Compared with Periphery
Fewer findings, and the differences checked
Lethen 3.10 against the latest Periphery release, 3.8.0, on five projects, with the source behind every difference read by hand.
| Project | Periphery | Lethen | What the differences were |
|---|---|---|---|
| swift-format | 29 | 29 | Identical. |
| Alamofire | 96 | 71 | All 30 Periphery-only findings were false positives or public API. |
| swift-argument-parser | 80 | 78 | Periphery-only: 8 public API, 1 debatable, 1 true positive. Lethen-only: 8 true positives. |
| swift-nio | 451 | 315 | 15 sampled Periphery-only: 12 false positives, 3 public API, 0 true positives. |
| Wikipedia iOS | 3,212 | 2,783 | 10 of 15 sampled Periphery-only groups were Swift called from Objective-C. |
How this was measured
Results with --retain-public, except Wikipedia iOS. Lethen 3.10.0 is master at d7dec6c. Periphery 3.8.0 is upstream tag 3.8.0 (a2db299), the latest upstream release. Both were built from source with swift build -c release. Alamofire, swift-argument-parser, swift-format and swift-nio ran on Linux x86_64 with Swift 6.4 (swift-6.4-RELEASE), at commits bda9ed5, 1021ac8, b15dd59 and feaf4ac, with --retain-public --format json --quiet --disable-update-check. Wikipedia iOS ran at 599e4a6 on an arm64 Mac with Xcode 27.0 (27A266a), Swift 6.4 and macOS 27, with --project Wikipedia.xcodeproj --schemes Wikipedia -- -destination "generic/platform=iOS Simulator".
Findings were matched on file, line, name and hint. For each project, every finding reported by only one tool was listed, and up to 15 per direction were checked by reading the source and, for Lethen, with lethen explain. The raw scan output is not published yet, so treat these numbers as a measurement we made, not a reproducible benchmark.
Not faster: cold scans were roughly equal. Lethen has recall losses of its own, such as unused imports in Objective-C files, and 22 % of Wikipedia iOS findings are only likely. Known issues are on GitHub.
Open source
Open source, down to every finding
MIT licensed. The analysis, the precision corpus and the release pipeline are all in the repository. No account, no telemetry, no paid tier.
The graph is what a scan walks. Whatever it never reaches is reported.
View on GitHubInstall
Up and running in two commands
On macOS, Xcode or the Command Line Tools must be installed.
Homebrew (Apple silicon)
$ brew install albovsky/tap/lethen $ lethen version
macOS zip
Signed and notarized, on every release.
Linux
x86_64 and aarch64 tarballs, glibc 2.35 or later. Steps.
From source
$ git clone https://github.com/albovsky/lethen $ cd lethen $ swift build -c release --product lethen
Also the route for Intel Macs.
Then scan
$ lethen scan --project-root /path/to/project
Xcode projects: --project App.xcodeproj --schemes App. Guide.
In GitHub Actions
- uses: albovsky/lethen@<version>
with:
baseline: baseline.json
Release 3.10.0 or later. On Linux, use a Swift 6.3+ container such as swift:6.4-noble.