<!--
{
  "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/Transformer",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents11TransformerP"
  },
  "title" : "Transformer"
}
-->

# Transformer

A transformer that takes an input and produces an output.

```
protocol Transformer<Input, Output>
```

## Topics

### Applying and adapting

[`applied(to:eventHandler:)`](/documentation/CreateMLComponents/Transformer/applied(to:eventHandler:))

Performs the transformation on a single input.

[`adaptedAsAnnotatedFeatureTransformer(annotationType:)`](/documentation/CreateMLComponents/Transformer/adaptedAsAnnotatedFeatureTransformer(annotationType:))

Returns an annotated-feature transformer that transforms the features using this transformer while leaving the
annotations unchanged.

[`adaptedAsAnnotatedPredictionTransformer(annotationType:)`](/documentation/CreateMLComponents/Transformer/adaptedAsAnnotatedPredictionTransformer(annotationType:))

Returns an annotated-prediction transformer that transforms the predictions using this transformer while
leaving the annotations unchanged.

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

Exposes this transformer as a trivial estimator.

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

Returns a random transformer wrapping a transformer.

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

Exposes this transformer as a temporal transformer.

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

Exposes this transformer as a trivial estimator.

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

The input type.

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

The output type.

### Appending

[`appending(_:)`](/documentation/CreateMLComponents/Transformer/appending(_:))

Composes this transformer with an annotated-feature transformer.

### Transforming and predicting

[`callAsFunction(_:eventHandler:)`](/documentation/CreateMLComponents/Transformer/callAsFunction(_:eventHandler:))

Performs the transformation on a single input.

[`prediction(from:)`](/documentation/CreateMLComponents/Transformer/prediction(from:))

Performs a prediction from a single input.

[`prediction(from:eventHandler:)`](/documentation/CreateMLComponents/Transformer/prediction(from:eventHandler:))

Performs a prediction on a sequence of annotated inputs.

### Exporting

[`export(to:)`](/documentation/CreateMLComponents/Transformer/export(to:))

Exports this transformer as a CoreML model.

[`export(to:metadata:)`](/documentation/CreateMLComponents/Transformer/export(to:metadata:))

Exports this transformer as a CoreML model with userInfo.



---

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)