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

# encode(to:)

Encodes this value into the given encoder.

## Declaration

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

## Parameters

- `encoder`: The encoder to write data to.

## See Also

### Encoding and decoding a vector

- [init(from:)](spatial/vector3d/init(from:).md)
