Structure
Scenario
public struct Scenario
Represents part of the component state.
Relationships
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 | Type | Description |
---|---|---|
name | ScenarioName |
A unique name of this scenario. |
layout | ScenarioLayout |
Represents how the component should be laid out. |
file | StaticString |
A file path where defined this scenario. |
line | UInt |
A line number where defined this scenario in file. |
content | @escaping (ScenarioContext) -> ScenarioContent |
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 | Type | Description |
---|---|---|
name | ScenarioName |
A unique name of this scenario. |
layout | ScenarioLayout |
Represents how the component should be laid out. |
file | StaticString |
A file path where defined this scenario. |
line | UInt |
A line number where defined this scenario in file. |
content | @escaping () -> ScenarioContent |
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 | Type | Description |
---|---|---|
name | ScenarioName |
A unique name of this scenario. |
layout | ScenarioLayout |
Represents how the component should be laid out. |
file | StaticString |
A file path where defined this scenario. |
line | UInt |
A line number where defined this scenario in file. |
content | @escaping (ScenarioContext) -> 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 | Type | Description |
---|---|---|
name | ScenarioName |
A unique name of this scenario. |
layout | ScenarioLayout |
Represents how the component should be laid out. |
file | StaticString |
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
buildScenarios()
public func buildScenarios() -> [Scenario]
Builds an array of scenarios containing only self
.