---
title: Encoder
framework: swift
role: symbol
role_heading: Protocol
path: swift/encoder
---

# Encoder

A type that can encode values into a native format for external representation.

## Declaration

```swift
protocol Encoder
```

## Topics

### Instance Properties

- [codingPath](swift/encoder/codingpath.md)
- [userInfo](swift/encoder/userinfo.md)

### Instance Methods

- [container(keyedBy:)](swift/encoder/container(keyedby:).md)
- [singleValueContainer()](swift/encoder/singlevaluecontainer().md)
- [unkeyedContainer()](swift/encoder/unkeyedcontainer().md)

## See Also

### Encoders and Decoders

- [Decoder](swift/decoder.md)
- [EncodingError](swift/encodingerror.md)
- [DecodingError](swift/decodingerror.md)
