Skip to content

chore: complete Swift 6 strict concurrency compatibility - #377

Open
NandanPrabhu wants to merge 1 commit into
masterfrom
chore/swift-6-strict-concurrency
Open

chore: complete Swift 6 strict concurrency compatibility#377
NandanPrabhu wants to merge 1 commit into
masterfrom
chore/swift-6-strict-concurrency

Conversation

@NandanPrabhu

@NandanPrabhu NandanPrabhu commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

Apps that depend on JWTDecode with strict Swift concurrency enabled should build successfully. The library sources already carried full Sendable conformance (added in #329), but the build configuration never compiled them in Swift 6 language mode — so nothing was enforcing that property, and regressions could land unnoticed.

No public API changes.

SWIFT_VERSION 5.0 → 6.0 across all 20 Xcode project configurations

This is the consumer-facing gap. Carthage consumers compile the sources through JWTDecode.xcodeproj, so the library was being built in Swift 5 language mode regardless of the Sendable annotations on the types.

Removed the .swiftLanguageMode(.v5) override on the SPM test target

With swift-tools-version:6.0 the target now inherits Swift 6 mode, so the tests compile under the same language mode as the library rather than opting out of it.

Removed the now-invalid @retroactive on the JWTDecodeError: Equatable test conformance

@retroactive only applies to conformances declared outside the type's own module; JWTDecodeError is in the same package, so this is an error under Swift 6. It was the one real compile error in the repo, and it was only hidden by the .v5 pin above.

📎 References

🎯 Testing

The existing 58 tests now execute in Swift 6 language mode rather than Swift 5, which is the main test-side coverage change — the assertions are unchanged, but they now run under the concurrency checking this PR enables.

Verified locally:

  • All five Xcode schemes — iOS, macOS, tvOS (58 tests each), watchOS and visionOS (build; no test target in the project)
  • swift test — 58 tests
  • pod lib lint — passes on all six platforms
  • Complete strict concurrency with warnings-as-errors, and library-evolution mode — both clean, zero warnings

Downstream consumer check. Since the goal is stated in terms of consumer apps, I verified against a separate SPM package built with -strict-concurrency=complete -warnings-as-errors in Swift 6 mode, exercising the cases a strict-concurrency app would hit:

  • Passing a decoded JWT into MainActor.run and Task.detached
  • Carrying a Claim across an isolation boundary
  • Storing a JWT in a @MainActor-isolated class
  • Binding JWT, Claim, body, and header to a <T: Sendable> generic
  • Catching JWTDecodeError across an isolation boundary

All compile with no warnings.

@NandanPrabhu
NandanPrabhu force-pushed the chore/swift-6-strict-concurrency branch from ed56013 to 6d8d61b Compare August 7, 2026 07:09
The library sources already carried full Sendable conformance, but the
build configuration did not compile them in Swift 6 language mode, so
regressions could land unnoticed.

- Set SWIFT_VERSION to 6.0 across all Xcode project configurations.
  This is what Carthage consumers compile against; it was still 5.0.
- Remove the .v5 language mode override on the SPM test target so tests
  compile in Swift 6 mode along with the library.
- Drop the now-invalid @retroactive on the JWTDecodeError: Equatable
  test conformance (the type is in the same package).

Verified: all five Xcode schemes build and test, swift test (58 tests),
pod lib lint on all six platforms, and a downstream SPM consumer built
with -strict-concurrency=complete -warnings-as-errors.
@NandanPrabhu
NandanPrabhu force-pushed the chore/swift-6-strict-concurrency branch from 6d8d61b to 74199de Compare August 7, 2026 10:55
@NandanPrabhu
NandanPrabhu marked this pull request as ready for review August 7, 2026 11:04
@NandanPrabhu
NandanPrabhu requested a review from a team as a code owner August 7, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants