I encountered an issue that I could use the SPM DocC plugin to produce documentation.
Will the new version of the Xcode 14 and SPM DocC plugin allow to build directly the documentation using the plugin for the frameworks that e.g. use the UIKit frameworks?
When I try to run the plugin and in addition pass sdk and target parameters
swift package -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios15.3-simulator" --allow-writing-to-directory ./docs generate-documentation --target UIEnvironment
Building for debugging...
Build complete! (0.09s)
Generating documentation for 'UIEnvironment'...
Building for debugging...
Build complete! (0.07s)
error: 'UIEnvironment' does not contain any documentable symbols or a DocC catalog and will not produce documentation
More about it on the Swift Forums: https://forums.swift.org/t/swift-docc-plugin-for-swiftpm/54725/30
Currently, I resolve to directly use Swift DocC
rm -rf .build;
mkdir -p .build/symbol-graphs \
&& swift build --target UIEnvironment \
-Xswiftc "-sdk" \
-Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" \
-Xswiftc "-target" \
-Xswiftc "arm64-apple-ios15.4-simulator" \-Xswiftc -emit-symbol-graph \
-Xswiftc -emit-symbol-graph-dir -Xswiftc .build/symbol-graphs;
mkdir -p .build/swift-docc-symbol-graphs \
&& mv .build/symbol-graphs/UIEnvironment* .build/swift-docc-symbol-graphs;
export DOCC_HTML_DIR="$(dirname $(xcrun --find docc))/../share/docc/render";
rm -rf docs-out;
mkdir -p docs-out/main \
&& ../swift-docc/.build/debug/docc convert Sources/UIEnvironment/Documentation.docc \
--fallback-display-name UIEnvironment \
--fallback-bundle-identifier com.plum.UIEnvironment \
--fallback-bundle-version 1.0.0 \
--additional-symbol-graph-dir .build/swift-docc-symbol-graphs \
--transform-for-static-hosting \
--hosting-base-path /UIEnvironment/main \
--output-path docs-out/main;
cp -R docs-out/main main
another solution is to use xcodebuild docbuild
Is it an expected shortcoming that cannot be resolved because of the multiplatform nature of SPM or just a temporary limitation?