init(configuration: Configuration) init(configuration:)Creates a new documentation generator.
The main orchestrator for generating static HTML documentation.
struct StaticDocumentationGeneratorUse 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.
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")
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
init(configuration: Configuration) init(configuration:)let configuration: Configuration configurationfunc generate() async throws -> GenerationResult generate()func renderFromArchive (URL) async throws -> GenerationResult renderSwift.Sendable Swift.SendableMetatype struct GenerationResult Generationenum GenerationError Generation