# OutputClass.encode(to:)

- **Module:** OutputClass
- **Package:** LibTmuxMCP
- **Language:** Swift
- **Kind:** method
- **Page:** https://libtmux.org/en/swift/latest/mcp/reference/outputclass-encode(to-)/

```
OutputClass.encode(to:)(to: any Encoder) -> ()
```

Encodes this value into the given encoder, when the type's `RawValue` is `String`.

This function throws an error if any values are invalid for the given
encoder's format.

- Parameter encoder: The encoder to write data to.
