---
title: "encode(to:)"
framework: coreml
role: symbol
role_heading: Instance Method
path: "coreml/mlshapedarrayslice/encode(to:)"
---

# encode(to:)

Encodes the array slice.

## Declaration

```swift
func encode(to encoder: any Encoder) throws
```

## Parameters

- `encoder`: The object that encodes the array slice.

## See Also

### Encoding and decoding an array slice

- [init(from:)](coreml/mlshapedarrayslice/init(from:).md)
