Swift Argument Parser is a command-line argument parsing library for Swift that provides type-safe parsing through property wrappers and declarative command definitions.
The library solves the problem of parsing command-line arguments by letting developers declare a type that represents their command's interface, decorating properties with property wrappers to specify arguments, options, and flags. Developers then conform to ParsableCommand or AsyncParsableCommand and implement a run method containing the command logic. The parser automatically instantiates the command type from command-line arguments, generates help text and error messages based on property names and types, and handles execution or exits with useful feedback.
Developers adopting this tool should know it works well for building command-line tools in Swift where type safety and automatic help generation are valuable. The library supports nested commands and subcommands, async/await patterns through AsyncParsableCommand, and hybrid options that function both as flags and as options with values. It suits projects ranging from simple straight-line scripts to tools with deep command hierarchies. The README does not compare it to alternatives.
The project maintains source stability with semantic versioning, meaning public API changes only occur in major version releases. The library embraces Swift language improvements and periodically requires clients to upgrade to newer Swift toolchain versions, though such requirements only trigger minor version bumps. Help text and error message formatting, along with examples, tests, and documentation, may change in any release without triggering a major version increment.