Skip to content

Add JSONValue and UncheckedSendable#736

Merged
mickael-menu merged 18 commits intoreadium:developfrom
stevenzeck:feature/swift6-json-sendable
Mar 4, 2026
Merged

Add JSONValue and UncheckedSendable#736
mickael-menu merged 18 commits intoreadium:developfrom
stevenzeck:feature/swift6-json-sendable

Conversation

@stevenzeck
Copy link
Contributor

In order to make the Swift 6 migration a little less painful, I wanted to extract 3 file changes separately. These are core to replacing the use of Any in json with type safe.

This doesn't break any functionality as they are simple additions.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces new Swift 6-migration helpers to replace untyped JSON (Any) with a type-safe JSONValue, plus an UncheckedSendable wrapper to ease Sendable adoption.

Changes:

  • Add JSONValue (Sendable/Hashable, literals, Codable) and ReadResult JSON decoding helpers returning JSONValue.
  • Add UncheckedSendable<T> wrapper for explicitly opting into @unchecked Sendable.
  • Add unit tests for JSONValue and update Carthage/Xcode project generation files to include the new sources.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Tests/SharedTests/Toolkit/JSONValueTests.swift Adds test coverage for JSONValue initialization, literals, Codable, and decoding helpers.
Sources/Shared/Toolkit/JSONValue.swift Introduces the type-safe JSON representation and conversions from Any, plus literal/Codable conformances.
Sources/Shared/Toolkit/UncheckedSendable.swift Adds a wrapper type to force Sendable conformance when the caller guarantees thread-safety.
Sources/Shared/Toolkit/JSON.swift Adds ReadResult-style helpers to decode Data/Data? into JSONValue / object dictionaries.
Support/Carthage/Readium.xcodeproj/project.pbxproj Includes the new Swift source files in the Carthage Xcode project build.
Support/Carthage/.xcodegen Updates the XcodeGen input list (currently includes unwanted .DS_Store paths).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mickael-menu mickael-menu merged commit 617f931 into readium:develop Mar 4, 2026
5 checks 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.

3 participants