Encodes a given value and associates it with a key.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Xcode 7.0+
The value to encode.
The key with which to associate the encoded value.
If there's a problem encoding the value you supply, this method throws an error based on the type of problem:
The value fails to encode, or contains a nested value that fails to encode—this method throws the corresponding error.
The value can't be encoded as a property list—this method throws the
Error .invalid Value(_: _:)