Skip to content

Instance Method

use(_:as:isDefault:)

Adds an AsyncCommand instance to the config.
mutating func use(_ command: any AnyAsyncCommand, as name: String, isDefault: Bool = false)

Parameters

command

Some AnyAsyncCommand. This type will be requested from the service container later.

name

A unique name for running this command.

isDefault

If true, this command will be set as the default command to run when none other are specified. Setting this overrides any previous default commands.

Discussion

var config = AsyncCommands()
config.use(barCommand, as: "bar")