Class

AMWorkflowController

The AMWorkflowController class lets you manage an Automator workflow in your application. You use the AMWorkflow class to instantiate a workflow and an instance of AMWorkflowView to display it.

Overview

A controller can run and stop a workflow and obtain information about its state. The controller’s delegate can receive messages as the workflow is executed and its actions are run.

You can load and run a workflow with minimal overhead by using the AMWorkflow class method run(at:withInput:). When you use AMWorkflowController, you get more control of the process, but there’s more work, as you must create and initialize both the workflow and the workflow controller objects.

A workflow is run in a separate process so that any actions it contains are executed in a separate memory space. That helps to insulate your application from crashes, memory leaks, or exceptions that might occur from running the actions in a workflow.

Topics

Accessing the workflow

var workflow: AMWorkflow?

Returns the receiver's workflow.

Accessing the workflow view

var workflowView: AMWorkflowView?

Returns the receiver's workflow view.

Accessing the delegate

var delegate: AMWorkflowControllerDelegate?

Returns the receiver's delegate.

Controlling the workflow

func pause(Any)

Pauses a workflow that is running.

func reset(Any)

Stops a workflow, clears any action results, and resets the workflow back to an un-run state.

func run(Any)

Runs the associated workflow, after first clearing any results stored by its actions during any previous run.

func step(Any)

In a paused workflow, runs the next action in the workflow and then pauses again.

func stop(Any)

Stops the associated workflow.

Getting workflow information

var canRun: Bool

Returns a Boolean value that indicates whether the receiver's workflow is able to run.

var isPaused: Bool

A Boolean value that indicates whether the receiver's workflow is currently paused.

var isRunning: Bool

A Boolean value that indicates whether the receiver's workflow is currently running.

Relationships

Inherits From