ActionCollectionResults

@MainActor
public struct ActionCollectionResults<ContentType> : Sendable where ContentType : ContentTypeable

This object contains results of the actions which completed in an ActionPerformableCollection, in the order they ran, with one result per sequence step or group.

  • The results of each action which completed in the sequence, in the order they ran. A group step contributes a single ActionResult whose ActionResponseSource/group(results:) origin holds its child results.

    Declaration

    Swift

    @MainActor
    public private(set) var results: [ActionResult<ContentType>] { get }
  • Appends a result to the sequence’s results. Generally this method is used by ActionGroup to add a merged result.

    Declaration

    Swift

    @MainActor
    public mutating func add(_ result: ActionResult<ContentType>)

    Parameters

    result

    The result of the action to add.

  • Appends the result for a single Interactor action step.

    Declaration

    Swift

    @MainActor
    public mutating func addResult(result: Result<ContentType, Error>, for action: any InteractorRequestActionTypeable, identifier: (any ActionIdentifying)? = nil, shouldSaveResult: Bool)

    Parameters

    content

    The content returned by the action.

    action

    The action type of the Interactor request.

    identifier

    An optional identifier of the step which produced this result.

  • Returns all results that match the specified identifier, searching group child results as well.

    Declaration

    Swift

    @MainActor
    public func results(matching identifier: some ActionIdentifying) -> [ActionResult<ContentType>]

    Parameters

    identifier

    The step identifier to search for.

    Return Value

    The matching responses, or an empty array if none were found.

  • Returns the last top-level result in the sequence that matches the specified identifier.

    Unlike results(matching:), this method only searches the top-level results and does not recurse into group child results.

    Declaration

    Swift

    @MainActor
    public func last(identifier: some ActionIdentifying) -> ActionResult<ContentType>?

    Parameters

    identifier

    The step identifier to search for.

    Return Value

    The last matching result, or nil if no match was found.

  • Returns all top-level results from the sequence that represent failed actions.

    Only top-level results are searched; group child results are not recursed into.

    Declaration

    Swift

    @MainActor
    public func failedActions() -> [ActionResult<ContentType>]

    Return Value

    An array of ActionResult values whose result is a .failure, or an empty array if all actions succeeded.