Encodes the contents of this dictionary into the given encoder.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Available when Key conforms to Encodable and Value conforms to Encodable.
Parameters
encoder
The encoder to write data to.
Discussion
If the dictionary uses String
or Int
keys, the contents are encoded in a keyed container. Otherwise, the contents are encoded as alternating key-value pairs in an unkeyed container.
This function throws an error if any values are invalid for the given encoder’s format.