---
title: "encodeWithOptimizer(_:to:)"
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: "createmlcomponents/updatableestimatortotemporaladaptor/encodewithoptimizer(_:to:)"
---

# encodeWithOptimizer(_:to:)

Encodes the transformer and optimizer to an encoder.

## Declaration

```swift
func encodeWithOptimizer(_ transformer: UpdatableEstimatorToTemporalAdaptor<Base>.Transformer, to encoder: inout any EstimatorEncoder) throws
```

## Parameters

- `transformer`: A transformer created by this estimator.
- `encoder`: An encoder.

## See Also

### Encoding and decoding

- [encode(_:to:)](createmlcomponents/updatableestimatortotemporaladaptor/encode(_:to:).md)
- [decode(from:)](createmlcomponents/updatableestimatortotemporaladaptor/decode(from:).md)
- [decodeWithOptimizer(from:)](createmlcomponents/updatableestimatortotemporaladaptor/decodewithoptimizer(from:).md)
