Documentation for swift projects

Hi Team,

I'm authoring a swift library and would like to include the documentation and landing page of the project within the library git repository. Other projects generally use https://docusaurus.io Is there any recommended approach for swift projects?

Thanks,

Arun

Have you checked Swift DocC?

1 Like

If this is a swift package, swift-docc-plugin provides package utilities to generate documentation using Swift Docc. Their documentation also cover deployment to GitHub Pages.

1 Like

If you're looking for something more akin to Docusaurus, have a look at https://kiln.brokenhands.io (which full disclosure I built). It's more static site generator than based off code comments and now supports blog and static sites

1 Like

Hey Arun -

If you're new to creating libraries and docs in Swift, definitely take a look at what DocC can provide for you. In particular, it's hooked assembled to pull all the public API and provide a default layout for documentation of your library using output from the compiler, and you can customize the content, add to it with markdown, or organize as you see fit with a DocC catalog (a specific directory structure).

You can host the results on GitHub pages relatively easily, or you can take the uber-simple route and request it to be added to the Swift Package Index, which hosts documentation for thousands of Swift packages and libraries - including generating and hosting the docs for releases as you tag them.

DocC itself is built into the Swift toolchain, but the SwiftPM plugin that @lopsae mentioned earlier is often the easiest way to create a host-able DocC archive (or preview the docs locally) on the command line.

The overall documentation for the DocC system itself is at Documentation, which @victorpuga also mentioned. There's a lot to it - but if you have questions, ping me and I'll see what I can do to help aim you in a useful direction.

3 Likes