OrderedDictionary is a lightweight implementation of an ordered dictionary data structure in Swift.
OrderedDictionary struct is a generic collection which combines the features of
Array from the Swift standard library. Like
Dictionary it stores key-value pairs with each key being unique and maps each key to an associated value. Like
Array it stores those pairs sorted and accessible by a zero-based integer index.
OrderedDictionary provides similar APIs like collections from the Swift standard library. This includes accessing contents by keys or indices, inserting and removing elements, iterating, sorting etc.
OrderedDictionary uses a backing store composed of an instance of
Dictionary for storing the key-value pairs and an instance of
Array for managing the ordered keys. This means it is not the most performant implementation possible, but it gets its job done by reusing most functionality from the Swift standard library.
- Swift 4.0+
- Xcode 9.2+
- iOS 8.0+ / macOS 10.10+
This library is distributed as a Swift framework and can be integrated into your project in following ways:
The easiest way is to use the package manager Carthage.
github "lukaskubanek/OrderedDictionary"to your
- Drag either the
OrderedDictionary.frameworkinto your project/workspace and link your target against the
- Make sure the framework gets copied to your application bundle.
- Import the framework using
Submodule & Xcode Project
Another option is to use Git submodules and integrating the Xcode project
OrderedDictionary.xcodeproj directly to your Xcode workspace.
Usage & Docs
The changelog is managed on the GitHub releases page.
OrderedDictionary is provided under the MIT License.
Help us keep the lights on
v2.0.0 - May 22, 2018
- Support for Swift 4.0 is still maintained
OrderedDictionarynow conditionally conforms to
- Used custom types for keys and values collections
- Simplified the
v1.1.0 - Mar 27, 2018
- Improved methods for insertion checks (aka
- Added an initializer from regular
- Added support for moving key-value pairs to a new index
v1.0.0 - Sep 25, 2017
This is the official release of OrderedDictionary which supports Xcode 9 and Swift 4. 🎉
v1.0.0-beta.3 - Aug 12, 2017
- Supports Xcode 9 β5
- Added initial conformance to Swift's
- Added two new initializers for instantiating an
OrderedDictionaryfrom a sequence of values
- Removed migration code
- Version 1.0.0 will be released when the final version of Swift 4 arrives
v1.0.0-beta.2 - Jul 18, 2017
This beta version supports Xcode 9 (β3) and Swift 4.