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
Creates a new documentation generator.
Instance Properties
The configuration for this generator.
Instance Methods
Generates static HTML documentation.
Renders documentation from an existing DocC archive to static HTML.
Relationships
Conforms To
See Also
Library API
Configure DocCStatic for your documentation needs.
The result of a documentation generation operation.
Errors that can occur during documentation generation.