swift-cidr 0.7.0 adds the opt-in CIDRArgumentParser product for using core
network currency types directly in Swift Argument Parser options and arguments.
Highlights
- Adds
ExpressibleByArgumentconformances for exactly eight types:Port,
AutonomousSystemNumber,IPAddress<Family>,IPEndpoint<Family>,
IPNetwork<Family>,PrefixLength<Family>,AnyIPAddress, and
AnyIPNetwork. - Reuses the existing strict parsers for family-bound and dual-stack values.
Bare addresses receive/32or/128; explicit address prefixes are
preserved; network host bits are canonicalized. - Canonicalizes endpoint ports, including forms such as
192.0.2.1:00179to192.0.2.1/32:179. - Adds
CustomStringConvertibleandLosslessStringConvertibleto core
Port, covering0...65535with canonical unpadded decimal output. - Preserves normal Argument Parser behavior: omitted optional values remain
nil, while explicit empty or otherwise invalid values fail parsing. - Provides no finite completion lists for these large value domains.
Compatibility
Swift Argument Parser >=1.7.0,<2.0.0 is supported. Consumers import
ArgumentParser, CIDR, and CIDRArgumentParser explicitly.
Only the new adapter target depends on Argument Parser. CIDR, CIDRPOSIX,
and CIDRNIO gain no Argument Parser target or link dependency, although
SwiftPM resolves the dependency for the overall package graph.
Public API changes from 0.6.1 are additive. Because this is a new minor version
of a pre-1.0 package, dependencies constrained to the 0.6.x line with
.upToNextMinor must explicitly adopt 0.7.0.
Deferred Surface
This release does not add Argument Parser conformances for AnyPrefixLength,
NetworkPrefixRange, address ranges or coverage, CIDRBlock, or multicast
group/range types and their mixed-family wrappers. DNS resolution, service-name
ports, ASN AS prefixes and asdot forms, and empty-string optional coercion
remain outside this adapter.
Port(0) remains valid shared currency; rejecting it for a remote peer remains
downstream policy.
Validation
- The annotated
0.7.0tag is SSH-signed and GitHub-verified. - 219 tests across 23 suites pass, including the permanent adapter coverage.
- Swift 6.2 and Swift 6.3 Linux CI, macOS 26/Xcode 26.6 CI, and the macOS
15/Xcode 26.3 compatibility lane pass. - Applicable targets build at the retained macOS 15 and iOS 18 deployment
floors. - A temporary consumer pinned to Swift Argument Parser 1.7.0 passes with
options, positional arguments, canonicalizable ports, mixed-family values,
and help generation. - Symbol-graph and API audits confirm exactly eight adapter conformances, no
Argument Parser dependency in the core targets, and an additive API delta
from 0.6.1. - DocC validation passes with warnings treated as errors.
- Same-machine benchmark comparison against untouched 0.6.1 found no
attributable regression; thresholds remain unchanged.
Full details are available in
Documentation/ReleaseNotes/0.7.0.md.