A Swift OrderedDictionary implementation based off of a Dictionary and an Array


This very naive implementation is inspired by ones such as used to be included in some of IBM's Kitura codebases.

It is well tested and it solves two problems with the Foundation Dictionary type when encoding/decoding:

  1. It supports keyed encoding/decoding as long as the OrderedDictionary keys are either LosslessStringConvertible or RawRepresentable as String.
  2. It retains ordering information while encoding/decoding. Although neither JSON nor YAML give syntactic value to the ordering of dictionaries, the ordering can still have semantic value to the next consumer of the JSON or YAML.


  • Swift Tools 5.1.0
View More Packages from this Author


Last updated: Thu Jun 01 2023 15:31:47 GMT-0900 (Hawaii-Aleutian Daylight Time)