How come KeyValuePairs has no initializer?

i was interested in using KeyValuePairs as a lightweight substitute for OrderedDictionary when all that is really needed is a [(key:Key, value:Value)] array, but an Array with a tuple element type cannot conform to a protocol.

it looks like KeyValuePairs can only be initialized using a dictionary literal. (or the variadic init(dictionaryLiteral:)) this is not a huge problem, as i can always define a custom _KeyValuePairs type that does have such an initializer. but i am curious as to why this was omitted from the standard library type.

1 Like

" enforce restraint" :rofl: