ContentTransformerWrapper

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

A type-erased box wrapping any object conforming to ContentTransformable for a specific ContentType.

Action doesn’t know the concrete Request.ResultData type of the Interactor whose assistant it holds. That type only exists at ActionConfiguration‘s generic scope where the Interactor assistant is built. ContentTransformerWrapper bridges that gap: ActionConfiguration wraps a typed ContentTransformable object in the wrapper and Action stores it.

Internally this stores the wrapped transformer inside a generic ConcreteContentTransformerBox, dispatched through the ContentTransformerBox witness table, which lets this type conform to Sendable unconditionally.

  • Wraps the given transformer, erasing its ResultData type.

    Declaration

    Swift

    @MainActor
    public init<Transformer>(_ transformer: Transformer) where ContentType == Transformer.Output, Transformer : ContentTransformable

    Parameters

    transformer

    The typed transformer to wrap.