Static analysis helpers for CocoaPods + .xcworkspace iOS projects.
Run Periphery dead-code detection end-to-end (with the workspace gotchas already handled), turn raw output into readable HTML/markdown, and generate a live Sourcery map of every type in the codebase.
| Problem | What this toolkit does |
|---|---|
| Periphery “succeeds” with empty output on CocoaPods workspaces | Cleans caches, reinstalls Pods if needed, tries multiple invocation strategies |
| Raw CSV/logs nobody reads | HTML report with priorities + cleanup suggestions |
| Build noise mixed into findings | Filters and categorizes real file:line:column hits |
| No up-to-date architecture snapshot | Sourcery template → markdown of every type, property, method |
ios-analysis-toolkit/
├── periphery-analysis-toolkit/ # Periphery runners + report scripts
│ ├── run_periphery_analysis.sh
│ ├── analyze_periphery_results.sh
│ ├── extract_real_results.sh
│ ├── inspect_csv_format.sh
│ └── periphery.yml.example
└── sourcery-project-structure/ # Sourcery config + Structure.stencil
├── Sourcery.yml
└── Templates/Structure.stencil
| Component | Role |
|---|---|
| periphery-analysis-toolkit | End-to-end Periphery runs + HTML/markdown reporting |
| sourcery-project-structure | Markdown overview of every type from Swift’s AST |
Requirements: Xcode, CocoaPods, Periphery.
cd periphery-analysis-toolkit
# Configure (env or edit the script top):
export PROJECT_DIR="/path/to/MyApp"
export WORKSPACE="MyApp.xcworkspace"
export SCHEME="MyApp"
export TARGET="MyApp"
./run_periphery_analysis.sh
# Optional hygiene + reports
./inspect_csv_format.sh PeripheryAnalysis/periphery_minimal_*.txt
./extract_real_results.sh PeripheryAnalysis/periphery_minimal_*.txt
./analyze_periphery_results.sh AnalysisResults/periphery_clean_results_*.csvWhat run_periphery_analysis.sh does:
- Clears Periphery / Xcode caches that often go stale
- Reinstalls CocoaPods if
Pods.xcodeprojis missing - Writes a tuned
.periphery.yml(codesigning / arch gotchas avoided) - Test-builds, then tries several Periphery modes until one yields output
- Emits a markdown summary of the run
Copy periphery.yml.example as a starting config for your app.
Requirements: Sourcery (brew install sourcery).
cd sourcery-project-structure
# Copy Sourcery.yml into your app root and set `sources` to your Swift folders
sourcery --config Sourcery.yml
# → Output/PROJECT_STRUCTURE.mdEach type gets a section: kind, protocols, properties, methods — useful as a living architecture cheat-sheet or input to other docs tooling.
run_periphery_analysis.sh
│
▼
inspect_csv_format.sh ← is this real findings or build log noise?
│
▼
extract_real_results.sh ← file:line:column only, by type / hot files
│
▼
analyze_periphery_results.sh ← prioritized HTML report
| Piece | Needs |
|---|---|
| Periphery toolkit | Xcode, CocoaPods, Periphery CLI |
| Sourcery structure | Sourcery CLI |
| Shell scripts | bash, standard Unix tools |
MIT — Copyright (c) 2021–2026 Juan Carlos Correa Arango
Juan Correa (@serenoj)
| Repo | Relation |
|---|---|
| ios-helper-tools | Sourcery mock templates for unit tests |
| ios-build-scripts | CI build / test / distribute scripts |