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 : InteractorRequestConfiguringParameters
resultThe Result object containing data returned from the request.
requestThe original request used in this Interactor operation.
-
handleAsyncInteractorResult(result:Asynchronousfor: ) 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 : InteractorRequestConfiguringParameters
resultThe Result object containing data returned from the request.
requestThe 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 -
performRequest(interactor:Asynchronousrequest: ) 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 : InteractorRequestConfiguringParameters
interactorThe type of Interactor that should receive the request.
requestA model that defines the request.
Return Value
A
Resultcontaining an array of items. -
Returns an Interactor for the specified type.
Declaration
Swift
@MainActor func interactor(for type: InteractorType) -> (any AbstractInteractable)?Parameters
typeThe enum type of an Interactor.
Return Value
An Interactor, if one was found.
View on GitHub