There are cases where
Dictionary is not good enough, being the most notorious one the case where the order of keys is important and should be preserved.
A good example of this are
.storyboard files, where XML nodes have attributes defined in a very specific order (defined by Xcode on write). Currently there is no way to parse the XML using
XMLParser while preserving the order of the attributes.
To clarify, Xcode itself does not seem to care about the order of the attributes when loading these files, but seems to write the attributes always in a specific order. Code diffs, in the other hand, quickly become burdensome when the order of XML node attributes is not preserved.
This "pitch" is intended to update
XMLParserDelegate.parser(_:didStartElement:namespaceURI:qualifiedName:attributes:) instance method to use
KeyValuePairs (or another similar data structure where the order of the keys is preserved), instead of
[String : String].
There are probably other methods, or areas where
KeyValuePairs could be used instead of a
Dictionary. If this pitch were to move forward, those methods should be listed in the proposal.