AggregateTransformer
public struct AggregateTransformer<Input, Output> : Transformer
A transformer that aggregates multiple transformers. Multiple aggregate transformers can be chained.
-
Creates a new instance of
AggregateTransformer
that will pass values in tofirstTransformer
, then pass the output fromfirstTransformer
in tosecondTransformer
.Declaration
Swift
public init<FirstTransformer: Transformer, SecondTransformer: Transformer>( firstTransformer: FirstTransformer, secondTransformer: SecondTransformer ) where FirstTransformer.Input == Input, FirstTransformer.Output == SecondTransformer.Input, SecondTransformer.Output == Output
Parameters
firstTransformer
The first transformer to call when transforming values.
secondTransformer
The second transformer to call when transforming values.
-
Transform the provided value by passing it to the first transformer, then the second transformer.
Throws
Any errors thrown by the transformers.Declaration
Swift
public func transformValue(_ value: Input) throws -> Output
Parameters
value
The value to transform
Return Value
The value returned bt the second transformer.
-
Transform the provided value by passing it to the second transformer, then the first transformer.
Throws
Any errors thrown by the transformers.Declaration
Swift
public func untransformValue(_ value: Output) throws -> Input
Parameters
value
The value to transform
Return Value
The value returned bt the first transformer.