finds.dev

ming1016/SMCheckProject

使用Swift3开发了个MacOS的程序可以检测出objc项目中无用方法,然后一键全部清理

View on GitHub

★ 553SwiftMITupdated Jun 2017

// the take

A Swift 3, macOS-only GUI tool that hand-rolls an Objective-C tokenizer/parser to build a map of defined vs. called methods across a project, then comments out whatever it finds unused. Aimed at iOS teams trying to shrink binary size by stripping dead code without reaching for a clang plugin or Mach-O/linkmap analysis.

The core idea is clever: instead of requiring a clang plugin build step or reverse-engineering a linkmap/otool diff, it tokenizes .h/.m files directly in Swift and builds its own lightweight method-definition and call graph. It doesn't just report dead methods, it one-click comments them out in place, which is the actual time sink the other approaches (clang plugin, WeChat's linkmap diffing, Mach-O stripping) leave to manual cleanup. The README is unusually transparent about the parser's internals, including how it handles nested bracket calls and block-typed return values.

The parser is a custom token scanner, not a real AST, so anything beyond straightforward Objective-C syntax is fragile: the author's own README flags @selector/respondsToSelector calls and ternary shorthand as special cases needing hacks, which means any pattern not explicitly handled will misclassify a method as dead. Automatically writing commented-out changes back to source files with no visible dry-run or diff-preview mode is risky given that fragility - a false positive silently breaks a build. It's Swift 3 targeting pre-ARC-era Objective-C codebases, hasn't been touched since mid-2017, and won't build against a current Xcode toolchain without a substantial rewrite. There are no tests, so there's no way to verify the dead-code detection logic against edge cases before trusting it on a real project.

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

// at a glance

Stars
553
Forks
84
Language
Swift
License
MIT
Last commit
30 Jun 2017

// nearby

If SMCheckProject isn't quite it.

All repos →