mirror of
https://github.com/nlohmann/json.git
synced 2026-10-05 14:10:31 +00:00
Document SwiftPM's #include <json.hpp> form and add CI coverage
Package.swift declares the json target with path: "single_include/nlohmann", so SwiftPM consumers must write #include <json.hpp>; the <nlohmann/json.hpp> form used throughout the rest of this documentation does not resolve. The SwiftPM section of package_managers.md only had the summary box and did not mention this, nor the #4650 linker problem: because the json target ships only headers, SwiftPM/Xcode look for a json.o that is never built, so a consumer needs at least one .cpp file of its own. Add a usage example (docs/mkdocs/docs/integration/swift/) that depends on the json product, includes <json.hpp>, and works around the linker problem with its own example.cpp; verified it builds with `swift build` against a local checkout. Also raise the deployment target from the deprecated .watchOS(.v4) to .watchOS(.v9): Swift 6.4 warns "'v4' is deprecated: watchOS 9.0 is the oldest supported version" on every `swift package` invocation, and `swift package dump-package` is now clean. This is the one behavior change in this commit: it raises the minimum watchOS version the package declares. Add a macOS CI job that runs `swift package dump-package` (so a future deprecation warning fails CI) and builds the new documentation example against the checked-out repository with `swift build`, so a change to Package.swift or the example is caught before release. No workflow previously referenced Swift or Package.swift. Adding an in-repository placeholder .cpp to the library itself, so the issue does not occur for consumers at all, was proposed and declined in #4650; the documented workaround is a consumer-side .cpp file instead. #5716 item 3 Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ import PackageDescription
|
||||
let package = Package(
|
||||
name: "nlohmann-json",
|
||||
platforms: [
|
||||
.iOS(.v12), .macOS(.v10_13), .tvOS(.v12), .watchOS(.v4), .visionOS(.v1)
|
||||
.iOS(.v12), .macOS(.v10_13), .tvOS(.v12), .watchOS(.v9), .visionOS(.v1)
|
||||
],
|
||||
products: [
|
||||
.library(name: "json", targets: ["json"])
|
||||
|
||||
Reference in New Issue
Block a user