In the DocC documentation, "Distributing Documentation to External Developers", Apple provided documentation to Host a Documentation Archive on Your Website. Unfortunately, when I open .doccarchive/index.html
, I just get a white page. They have only shown guidance for Apache servers. They have specified using a .htaccess
file, and using RewriteRule .* SlothCreator.doccarchive/$0 [L]
to rewrite URLs when a user visits the documentation page.
Is there a way to open the documentation web app without running an Apache server? (I don't want to make any machine specific configuration like modifying /etc/hosts
). It would be ideal to be able to host this as a static site (e.g. on Github pages, Cloudflare pages, Netlify, etc.)
Edit: With @Ranoiaetep's answer, I have built and pushed it to a GitHub repo and it can be viewed through a Netlify site: https://xcode-docc.netlify.app/documentation/
Update for Xcode 13.3
Note: I recommend iOS developers to avoid using the DocC plugin as outlined above because it's an extra dependency that's unnecessary if we have Xcode CLI tools installed already.
This wasn’t possible until recently enabled by the improvements in Xcode 13.3.
I've outlined multiple steps for DocC app/Package doccarchive deployment through GitHub Pages in my latest blog post.
The key steps to resolve several issues I had:
xcodebuild -project ModularSlothCreator.xcodeproj -scheme ModularSlothCreator -parallelizeTargets docbuild
to build a modular documentation archive.transform-for-static-hosting
flag provided by the docc cli${xcrun docc} transform-for-static-hosting ..
.For more details and a CI script, feel free to reference the blog post.