NAME
swift-package-info — Swift CLI tool that provides information about a Swift Package
SYNOPSIS
INFO
DESCRIPTION
Swift CLI tool that provides information about a Swift Package
README
Swift Package Info
CLI tool, built on top of Swift Argument Parser, that provides information about a given Swift Package product, such as a measurement of its binary size impact.
Binary size calculation is also available as a library via the SwiftPackageInfo package product.
Usage
Examples
- Run a complete analysis
swift-package-info --for https://github.com/ReactiveX/RxSwift -v 6.0.0 --product RxSwift
- Check supported platforms (sub command)
swift-package-info platforms --for https://github.com/krzyzanowskim/CryptoSwift -v 1.3.8 --product CryptoSwift
- See the binary size of a local package (e.g., under development framework)
swift-package-info binary-size --path ../project/my-framework
Report
swift-package-info --for https://github.com/ReactiveX/RxSwift -v 6.0.0 --product RxSwift
+------------------------------------------------+
| Swift Package Info |
| |
| RxSwift, 6.0.0 |
+--------------+---------------------------------+
| Provider | Results |
+--------------+---------------------------------+
| Binary Size | Binary size increases by 963 KB |
| Platforms | System default |
| Dependencies | No third-party dependencies :) |
+--------------+---------------------------------+
> Total of 3 providers used.
A custom report strategy can be passed via the report argument (check --help for supported values)
swift-package-info --for https://github.com/ReactiveX/RxSwift -v 6.0.0 --product RxSwift --report jsonDump
{ "binarySize" : { "amount" : 962560, "formatted" : "963 KB" }, "dependencies" : [], "platforms" : {
} }
Requirements
- Swift >= 6.1
- Xcode >= 16.4
Installation
- Install mint
- Optionally add mint to your $PATH
- Run:
mint install marinofelipe/swift-package-infoto install the latest version
Running
mint run swift-package-info- or simply,
swift-package-infoin case it was symlinked
Binary size report
Its methodology is inspired by cocoapods-size, and thus works by comparing archives with no bitcode and ARM64 arch. Such a strategy has proven consistent with the size of iOS apps downloaded and installed via TestFlight.
Thanks
Special thanks to @unnamedd for sharing his experience with swift-tools-support-core and on how to build a pretty 👌 report.
Contributing
Check the CONTRIBUTING.md file.