InteractorResultHandling

@MainActor
public protocol InteractorResultHandling<InteractorType, ContentType> : AnyObject, Sendable

A protocol that defines an interface for performing Interactor requests and handling their results.

Conforming types are generally type-erased Destinations that dispatch requests to Interactors and process the Result objects that their operations return. This allows Interactor assistants to be reused across different Destination objects instead of being tightly coupled to one.

  • An enum which defines types of Interactors. Each Destination may have its own Interactor types.

    Declaration

    Swift

    associatedtype InteractorType : InteractorTypeable
  • Undocumented

    Declaration

    Swift

    associatedtype ContentType : ContentTypeable
  • Handles the result of an Interactor request in a synchronous context.

    Declaration

    Swift

    @MainActor
    func handleInteractorResult<Request>(result: Result<Request.ResultData, Error>, for request: Request) where Request : InteractorRequestConfiguring

    Parameters

    result

    The Result object containing data returned from the request.

    request

    The original request used in this Interactor operation.

  • Handles the result of an async Interactor request.

    Declaration

    Swift

    @MainActor
    func handleAsyncInteractorResult<Request>(result: Result<Request.ResultData, Error>, for request: Request) async where Request : InteractorRequestConfiguring

    Parameters

    result

    The Result object containing data returned from the request.

    request

    The original request used in this Interactor operation.

  • Performs a request with the specified Interactor.

    Declaration

    Swift

    @MainActor
    func performRequest<Request>(interactor: InteractorType, request: Request) where Request : InteractorRequestConfiguring
  • Performs a request with the specified Interactor asynchronously.

    Declaration

    Swift

    @MainActor
    func performRequest<Request>(interactor: InteractorType, request: Request) async -> Result<Request.ResultData, Error> where Request : InteractorRequestConfiguring

    Parameters

    interactor

    The type of Interactor that should receive the request.

    request

    A model that defines the request.

    Return Value

    A Result containing an array of items.

  • Returns an Interactor for the specified type.

    Declaration

    Swift

    @MainActor
    func interactor(for type: InteractorType) -> (any AbstractInteractable)?

    Parameters

    type

    The enum type of an Interactor.

    Return Value

    An Interactor, if one was found.