Contents

Step

Defines an individual task the reader performs within a set of steps on a tutorial page.

Declaration

@Step {
    ...
}

Overview

Use the Step directive to define a single task the reader performs within a set of steps on a tutorial page. Provide text that explains what to do, and provide a code listing , an image, or a video that illustrates the step.

[Image]

@Tutorial(time: 30) {
    @Intro(title: "Creating Custom Sloths") {
        
        ...

    }
    
    @Section(title: "Create a new folder and add SlothCreator") {
        @ContentAndMedia {
            
            ...
            
        }
        
        @Steps {
            @Step {
                Create the folder.
                
                @Image(source: placeholder-image, alt: "A screenshot using the `mkdir` command to create a folder to place SlothCreator in.")
            }
            
            ...
                            
        }
    }
}

Setting Context for a Step

To provide additional context about the step, add text before or after the step.

[Image]

The following steps display your customized sloth view in the preview.

@Step {
    Add the `sloth` parameter to initialize the `CustomizedSlothView` in the preview provider, and pass a new `Sloth` instance for the value.
    
    @Code(name: "CustomizedSlothView.swift", file: 01-creating-code-02-07.swift) {
        @Image(source: preview-01-creating-code-02-07.png, alt: "A portrait of a generic sloth displayed in the center of the canvas.")
    }
}

Contained Elements

A step contains one the following items:

Code

A code listing, and optionally a preview of the expected result, reader sees when they reach the step. (optional)

Image

An image the reader sees when they reach the step. (optional)

Video

A video the reader sees when they reach the step. (optional)

Containing Elements

The following items can include a step:

Topics

Displaying Code

Displaying Media