Swift package to read and process "DocC" archives

What's New



Support the "Application" RoleHeading, as reported in DoccZz/docc2html#20


Swift package to read and process "DocC" archives, a format to document Swift frameworks and packages: Documenting a Swift Framework or Package.

Blog entry on the topic: DocC 📚 Archived and Analyzed.


The module can import all documents created in the SlothCreator example.

It should be pretty complete.

If you find an issue (usually signalled by an assertion or fatalError), please let us know, we'll fix missing cases ASAP (PRs are welcome too).


  • Add DocC documentation! 🤦‍♀️
  • Add a testsuite (existing one not added for sizing concerns).

Usage in a Swift Package

Example Package.swift:

// swift-tools-version:5.0

import PackageDescription

let package = Package(
  name         : "hackdocc",
  products     : [ .executable(name: "hackdocc", targets: [ "hackdocc" ]) ],
  dependencies : [
    .package(url: "", from: "0.1.1")
  targets: [ .target(name: "hackdocc", dependencies: [ "DocCArchive" ]) ]

Using the Code

DocCArchive has three main types:

  • DocCArchive, represents the whole archive structure
  • DocumentFolder , represents a documentation folder within that structure
  • Document, represents a a documentation page (topics, types, tutorials, etc, the "JSON files")

Open the archive, access the documentation folder (tutorials is the other one), then Document's can be opened in the folder.

let url     = URL(fileURLWithPath: "~/Downloads/SlothCreator.doccarchive")
let archive = try DocCArchive(contentsOf: url)

if let docs = archive.documentationFolder() {
  ... work it ...


servedocc is brought to you by the Always Right Institute and ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.


  • Swift Tools 5.0.0
View More Packages from this Author


  • None
Last updated: Wed Nov 09 2022 22:54:07 GMT-0500 (GMT-05:00)