Skip to content

fix: exclude .formatted date strategy case on Linux#9

Merged
vnixx merged 1 commit intomainfrom
fix/linux-compilation
Apr 27, 2026
Merged

fix: exclude .formatted date strategy case on Linux#9
vnixx merged 1 commit intomainfrom
fix/linux-compilation

Conversation

@vnixx
Copy link
Copy Markdown
Member

@vnixx vnixx commented Apr 27, 2026

Summary

  • On Linux, swift-foundation (FoundationEssentials) does not define .formatted as an enum case on DateEncodingStrategy / DateDecodingStrategy. It is guarded by #if FOUNDATION_FRAMEWORK and only exists on Apple platforms.
  • swift-corelibs-foundation provides a static func formatted(_ formatter:) that returns .custom(...) as a compatibility shim, so the .custom case already handles it at runtime.
  • Wrap the .formatted(let formatter) switch cases with #if !os(Linux) in both JSONDecoderImpl.swift and JSONEncoderImpl.swift.

Closes #7

Test plan

  • Verify compilation on Linux (Swift 6.x)
  • Verify existing tests still pass on macOS

Made with Cursor

On Linux, swift-foundation (FoundationEssentials) does not define
.formatted as an enum case on DateEncodingStrategy/DateDecodingStrategy.
Instead, swift-corelibs-foundation provides a static func .formatted()
that returns .custom(...), so the .custom case already handles it.

Closes #7

Made-with: Cursor
@vnixx vnixx merged commit 2d08e33 into main Apr 27, 2026
1 check passed
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.

Unable to compile on Linux

1 participant