Chapter 6.2  ·  Gate 06.2 ·  Actions and Controllers

Action Controllers

Action Controllers are the only coordination-layer type allowed to touch AppKit at all — the one bridge between a user gesture and a dispatched Action. This subchapter covers that bridge, and where its result ends up once the Action finishes.

The only AppKit-side bridge

An Action Controller presents a dialog, collects the user’s input, builds an Action from it, and dispatches it. Everything downstream of that dispatch, per the boundary in Chapter 1, is Foundation-only again.

A common shape opens a result window immediately, before the Action has finished: a loading view binds to action.status, and once it flips to .completed, the controller fetches the result from the domain manager and swaps the content in. Results live on the manager, not on the Action itself — the Action stays focused on lifecycle, and a background-triggered run of the same work (no Action wrapper at all) can produce and cache a result the same way. That background-triggered case is exactly what a background controller does — see Chapter 4.

Ahead in this guide Validators — the precondition checks Action Controllers use to enable or disable UI, referenced above — get their own subchapter next: Chapter 6.3, Action Validation. The serial runner and job structs used throughout Actions and Action Controllers are covered properly in Chapter 7, Concurrency.