---
title: "encode(to:)"
framework: Evaluations
role: symbol
role_heading: Instance Method
platforms: [iOS 27.0+, iPadOS 27.0+, Mac Catalyst 27.0+, macOS 27.0+, visionOS 27.0+, watchOS 27.0+, xcode 27.0+]
path: "evaluations/argumentmatcher/encode(to:)"
---

# encode(to:)

Encodes this argument matcher into the given encoder.

## Declaration

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

## Parameters

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

## Discussion

Discussion note: An error if encoding fails.
