Motivation
This package supports Codable date handling using ISO 8601 strings. Since the package targets cross-platform Swift, the implementation should fit well with Swift 6 strict concurrency and modern Foundation APIs.
ISO8601DateFormatter is a mutable reference type. It is commonly used as a cached shared formatter, but that pattern is awkward in Swift 6 concurrency because it can introduce Sendable issues or require unsafe workarounds.
Date.ISO8601FormatStyle is the newer value-style API for ISO 8601 formatting and parsing. Using it would make the implementation easier to reason about, more concurrency-friendly, and better aligned with modern Swift.
Proposed change
Replace internal uses of ISO8601DateFormatter with Date.ISO8601FormatStyle where possible, while preserving the current encoded date representation.
Important compatibility points:
- preserve UTC /
Z behavior
- preserve fractional seconds behavior
- keep existing
Codable round-trip behavior
- add tests for representative date encoding/decoding cases
Expected benefit
- Better Swift 6 strict concurrency compatibility
- Less reliance on shared mutable formatter state
- Fewer unsafe
Sendable workarounds
- More modern Foundation API usage
Motivation
This package supports
Codabledate handling using ISO 8601 strings. Since the package targets cross-platform Swift, the implementation should fit well with Swift 6 strict concurrency and modern Foundation APIs.ISO8601DateFormatteris a mutable reference type. It is commonly used as a cached shared formatter, but that pattern is awkward in Swift 6 concurrency because it can introduceSendableissues or require unsafe workarounds.Date.ISO8601FormatStyleis the newer value-style API for ISO 8601 formatting and parsing. Using it would make the implementation easier to reason about, more concurrency-friendly, and better aligned with modern Swift.Proposed change
Replace internal uses of
ISO8601DateFormatterwithDate.ISO8601FormatStylewhere possible, while preserving the current encoded date representation.Important compatibility points:
ZbehaviorCodableround-trip behaviorExpected benefit
Sendableworkarounds