2022 Developer Tools
WWDC22 · 18 min · Developer Tools
What’s new in Swift-DocC
Join us for an exciting update on Swift-DocC and learn how you can write and share documentation for your own projects. We’ll explore improvements to Swift-DocC navigation and share how you can compile documentation for application targets and Objective-C code. We’ll also show you how to publish your content straight to hosting services like GitHub Pages.
Watch at developer.apple.com ↗Code shown on screen · 4 snippets
Documenting the SlothView struct
/// A view that displays a sloth.
///
/// This is the main view of ``SlothyApp``.
/// Create a sloth view by providing a binding to a sloth.
///
/// ```swift
/// @State private var sloth: Sloth
///
/// var body: some View {
/// SlothView(sloth: $sloth)
/// }
/// ```
struct SlothView: View {
// ...
} Documenting an initializer
struct SlothView: View {
/// Creates a view that displays the specified sloth.
///
/// - Parameter sloth: The sloth the user will edit.
init(sloth: Binding<Sloth>) {
// ...
}
} Documenting the SLOSound Objective-C class
/// A sound that can be played.
///
/// Use an instance of this type to play a sound
/// to the user in response to an action or
/// event.
@interface SLOSound : NSObject
/// Creates a sound given its name and path on
/// disk.
///
/// - Parameters:
/// - name: The name of the sound.
/// - filePath: The path to the sound file on disk.
- (id)initWithName:(NSString *)name
filePath:(NSString *)filePath;
@end Documenting the top-level page for the Slothy app
# ``Slothy``
An app to create and care for custom sloths.
## Overview
Slothy is an iOS app that allows users to create and care for virtual sloths.

The Slothy app project contains views to present Slothy's user interface, and utilities to play sounds as the user interacts with the app. Resources
Related sessions
-
34 min