<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateMLComponents",
  "identifier" : "/documentation/CreateMLComponents/ComposedTransformer",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents19ComposedTransformerV"
  },
  "title" : "ComposedTransformer"
}
-->

# ComposedTransformer

A transformer that composes two transformers by applying them one after the other.

```
struct ComposedTransformer<Inner, Outer> where Inner : Transformer, Outer : Transformer, Inner.Output == Outer.Input
```

## Overview

The inner transformer’s output must match the outer transformer input. The result of this transformer is equivalent
to invoking `outer(inner(x))` on an input `x`,

## Topics

### Creating the transformer

[`init(Inner, Outer)`](/documentation/CreateMLComponents/ComposedTransformer/init(_:_:))

Creates a transformer composition from two transformers.

### Getting the properties

[`var inner: Inner`](/documentation/CreateMLComponents/ComposedTransformer/inner)

The inner transformer.

[`var outer: Outer`](/documentation/CreateMLComponents/ComposedTransformer/outer)

The outer transformer.

### Performing the transformation

[`func applied(to: ComposedTransformer<Inner, Outer>.Input, eventHandler: EventHandler?) async throws -> ComposedTransformer<Inner, Outer>.Output`](/documentation/CreateMLComponents/ComposedTransformer/applied(to:eventHandler:))

Performs the composed transformation on a single input.

[`typealias Input`](/documentation/CreateMLComponents/ComposedTransformer/Input)

The input type.

[`typealias Intermediate`](/documentation/CreateMLComponents/ComposedTransformer/Intermediate)

The intermediate type.

[`typealias Output`](/documentation/CreateMLComponents/ComposedTransformer/Output)

The output type.

## Relationships

### Conforms To

[`Transformer`](/documentation/CreateMLComponents/Transformer)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Copyable`](/documentation/Swift/Copyable)

[`Sendable`](/documentation/Swift/Sendable)

[`Decodable`](/documentation/Swift/Decodable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Encodable`](/documentation/Swift/Encodable)

[`Escapable`](/documentation/Swift/Escapable)

[`Equatable`](/documentation/Swift/Equatable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)