---
title: "encode(contentsOf:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/unkeyedencodingcontainer/encode(contentsof:)-62wy5"
---

# encode(contentsOf:)

Encodes the elements of the given sequence.

## Declaration

```swift
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == UInt64
```

## Parameters

- `sequence`: The sequences whose contents to encode.

## Discussion

Discussion note: An error if any of the contained values throws an error.
