SyncCommand

open class SyncCommand : Command

Base class for synchronous commands that preserves typed throws.

Subclass this and override execute(payload:) throws(CommandError) for commands that complete their work synchronously (e.g. setting a user property, logging an event).

The protocol requirement is handled by a final wrapper — subclasses cannot accidentally override the wrong overload.

  • Declaration

    Swift

    public let name: String
  • Creates a synchronous command with the given name.

    Declaration

    Swift

    public init(name: String)

    Parameters

    name

    The name used to identify and route this command in a CommandRegistry.

  • Protocol requirement — delegates to the synchronous overload. Do not override.

    Declaration

    Swift

    public final func execute(payload: DataObject, completion: @escaping (CommandError?) -> Void) -> any Disposable
  • Override this for synchronous command logic.

    Throws

    CommandError if validation fails or required parameters are missing.

    Declaration

    Swift

    open func execute(payload: DataObject) throws(CommandError)