Class
Playbook
open class Playbook
The central scenario manager.
You can use the singleton default
or use it
with instantiate arbitrarily.
struct Content: View {
var body: some View {
Text("Playbook")
}
}
Playbook.default.addScenarios(of: "Components") {
Scenario("Content", layout: .compressed) {
Content()
}
}
Initializers
init()
public init()
Initialize a new Playbook
.
Properties
`default`
let `default`
The default shared instance of Playbook
.
Methods
scenarios(of:)
public func scenarios(of kind: ScenarioKind) -> ScenarioStore
Returns a store identified by specified kind.
If there is no store yet, add and return it.
Parameters
Name | Type | Description |
---|---|---|
kind | ScenarioKind |
A unique identifier that stores a set of scenarios. |
Returns
A store identified by specified kind.
add(_:)
@discardableResult public func add<Provider: ScenarioProvider>(_ provider: Provider.Type) -> Self
Adds a set scenarios defined in specified provider.
Parameters
Name | Type | Description |
---|---|---|
provider | Provider.Type |
A type of provider that provides a set of scenarios. |
Returns
A instance of self
.
addScenarios(of:_:)
@discardableResult public func addScenarios<S: ScenariosBuildable>(of kind: ScenarioKind, _ scenarios: () -> S) -> Self
Adds a set of scenarios passed by function builder.
Parameters
Name | Type | Description |
---|---|---|
kind | ScenarioKind |
A unique identifier that stores a set of scenarios. |
scenarios | () -> S |
A function builder that create a set of scenarios. |
Returns
A instance of self
.