Playbook Documentation

Structure Scenario

public struct Scenario  

Represents part of the component state.

Scenario Scenario ScenariosBuildable ScenariosBuildable Scenario->ScenariosBuildable

Conforms To

ScenariosBuildable

Represents an instance that can build an array of scenarios.

Initializers

init(_:​layout:​file:​line:​content:​)

public init(
        _ name: ScenarioName,
        layout: ScenarioLayout,
        file: StaticString = #file,
        line: UInt = #line,
        content: @escaping (ScenarioContext) -> ScenarioContent
    )  

Creates a new scenario.

Parameters

name Scenario​Name

A unique name of this scenario.

layout Scenario​Layout

Represents how the component should be laid out.

file Static​String

A file path where defined this scenario.

line UInt

A line number where defined this scenario in file.

content @escaping (Scenario​Context) -> Scenario​Content

A closure that make a new content with passed context.

init(_:​layout:​file:​line:​content:​)

public init(
        _ name: ScenarioName,
        layout: ScenarioLayout,
        file: StaticString = #file,
        line: UInt = #line,
        content: @escaping () -> ScenarioContent
    )  

Creates a new scenario.

Parameters

name Scenario​Name

A unique name of this scenario.

layout Scenario​Layout

Represents how the component should be laid out.

file Static​String

A file path where defined this scenario.

line UInt

A line number where defined this scenario in file.

content @escaping () -> Scenario​Content

A closure that make a new content.

init(_:​layout:​file:​line:​content:​)

init<Content: View>(
        _ name: ScenarioName,
        layout: ScenarioLayout,
        file: StaticString = #file,
        line: UInt = #line,
        content: @escaping (ScenarioContext) -> Content
    )  

Creates a new scenario with SwiftUI view.

Parameters

name Scenario​Name

A unique name of this scenario.

layout Scenario​Layout

Represents how the component should be laid out.

file Static​String

A file path where defined this scenario.

line UInt

A line number where defined this scenario in file.

content @escaping (Scenario​Context) -> Content

A closure that make a new content with passed context.

init(_:​layout:​file:​line:​content:​)

init<Content: View>(
        _ name: ScenarioName,
        layout: ScenarioLayout,
        file: StaticString = #file,
        line: UInt = #line,
        content: @escaping () -> Content
    )  

Creates a new scenario with SwiftUI view.

Parameters

name Scenario​Name

A unique name of this scenario.

layout Scenario​Layout

Represents how the component should be laid out.

file Static​String

A file path where defined this scenario.

line UInt

A line number where defined this scenario in file.

content @escaping () -> Content

A closure that make a new content.

Properties

name

public var name: ScenarioName

A unique name of scenario that describes component and its state.

layout

public var layout: ScenarioLayout

Represents how the component should be laid out.

file

public var file: StaticString

A file path where defined this scenario.

line

public var line: UInt

A line number where defined this scenario in file.

content

public var content: (ScenarioContext) -> ScenarioContent

A closure that make a new content with passed context.

Methods

build​Scenarios()

public func buildScenarios() -> [Scenario]  

Builds an array of scenarios containing only self.