Skip Navigation
StructureStructure

StaticDocumentationGenerator

The main orchestrator for generating static HTML documentation.

struct StaticDocumentationGenerator

Overview

Use this type to generate static HTML documentation from a Swift package. The generator processes symbol graphs, articles, and tutorials, then outputs a complete static website that can be viewed locally or hosted on any web server.

Usage

Create a generator with a configuration, then call generate() to produce the documentation:

let configuration = Configuration(
    packageDirectory: URL(fileURLWithPath: "."),
    outputDirectory: URL(fileURLWithPath: ".build/docs")
)
let generator = StaticDocumentationGenerator(configuration: configuration)
let result = try await generator.generate()
print("Generated \(result.generatedPages) pages")

Output Structure

The generator produces the following directory structure:

output/
├── index.html              # Combined landing page
├── sidebar.html            # Navigation tree shared by all documentation pages
├── css/
│   └── main.css           # Stylesheet
├── js/
│   └── search.js          # Optional search functionality
├── {package}/
│   ├── index.html         # Package overview
│   └── {module}/
│       ├── index.html     # Module overview
│       └── {symbol}/
│           └── index.html # Symbol documentation
└── search-index.json      # Optional search index

Relationships

  • Swift.Sendable
  • Swift.SendableMetatype

See Also