Documentation Language: Swift

Structure

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.

Overview

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
├── 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

Topics

Initializers

?
init(configuration:)

Creates a new documentation generator.

Instance Properties

V
configuration

The configuration for this generator.

Instance Methods

F
generate()

Generates static HTML documentation.

F
renderFromArchive(_:)

Renders documentation from an existing DocC archive to static HTML.

Relationships

Conforms To

See Also

Library API

A
Configuration Reference

Configure DocCStatic for your documentation needs.

S
GenerationResult

The result of a documentation generation operation.

E
GenerationError

Errors that can occur during documentation generation.