@@ -19,11 +19,11 @@ extension OrderedDictionary: Encodable where Key: Encodable, Value: Encodable {
1919 /// encoder's format.
2020 ///
2121 /// - Note: Unlike the standard `Dictionary` type, ordered dictionaries
22- /// always encode in an unkeyed container, because `Codable`'s keyed
23- /// containers do not guarantee that they preserve the ordering of the
24- /// items they contain. (And in popular encoding formats, keyed containers
25- /// tend to map to unordered data structures -- e.g., JSON's "object"
26- /// construct is explicitly unordered.)
22+ /// always encode themselves into an unkeyed container, because
23+ /// `Codable`'s keyed containers do not guarantee that they preserve the
24+ /// ordering of the items they contain. (And in popular encoding formats,
25+ /// keyed containers tend to map to unordered data structures -- e.g.,
26+ /// JSON's "object" construct is explicitly unordered.)
2727 ///
2828 /// - Parameter encoder: The encoder to write data to.
2929 @inlinable
@@ -40,8 +40,18 @@ extension OrderedDictionary: Encodable where Key: Encodable, Value: Encodable {
4040extension OrderedDictionary : Decodable where Key: Decodable , Value: Decodable {
4141 /// Creates a new dictionary by decoding from the given decoder.
4242 ///
43+ /// `OrderedDictionary` expects its contents to be encoded as alternating
44+ /// key-value pairs in an unkeyed container.
45+ ///
4346 /// This initializer throws an error if reading from the decoder fails, or
44- /// if the decoded contents are corrupt (such as they contain duplicate values).
47+ /// if the decoded contents are not in the expected format.
48+ ///
49+ /// - Note: Unlike the standard `Dictionary` type, ordered dictionaries
50+ /// always encode themselves into an unkeyed container, because
51+ /// `Codable`'s keyed containers do not guarantee that they preserve the
52+ /// ordering of the items they contain. (And in popular encoding formats,
53+ /// keyed containers tend to map to unordered data structures -- e.g.,
54+ /// JSON's "object" construct is explicitly unordered.)
4555 ///
4656 /// - Parameter decoder: The decoder to read data from.
4757 @inlinable
0 commit comments