DocC

Turn your code comments into rich, browsable documentation.

Introduced
2021
WWDC21
Kind
Tool
Runs on
Xcode 13 or later
Get it from
Included with Xcode
iOS
iPadOS
Mac Catalyst
macOS
tvOS
visionOS
watchOS
The documentation DocC builds from those comments.

Overview

DocC compiles the comments in your Swift code into documentation that looks and works like Apple's own. Add articles, step-by-step tutorials and symbol links, and build it right inside Xcode.

It can also export a static website, so hosting your package's docs on GitHub Pages is straightforward.

Symbol documentation

Every public type and method gets a page from its doc comment.

Articles

Write conceptual guides in Markdown, right next to your code.

Tutorials

Step-by-step interactive tutorials with code and images.

Static hosting

Export a website you can host anywhere, including GitHub Pages.

Price.swift
/// A price in a given currency. /// /// Use ``applying(discount:)`` to get a reduced price. /// /// ```swift /// let sale = Price(amount: 20).applying(discount: 25) /// ``` public struct Price { /// The amount, in the smallest currency unit. public let amount: Int }

History

How it grew up.

2021

Introduced

DocC arrives in Xcode 13.

2021

Open source

Swift-DocC is open-sourced later that year.

2022

Objective-C and C

Xcode 14 documents Objective-C and C APIs too.

2023

Documentation Preview

Xcode 15 previews docs as you write, plus grids and video.