Introducing Swift Collections

I’m thrilled to announce Swift Collections, a new open-source package focused on extending the set of available Swift data structures. Like the Swift Algorithms and Swift Numerics packages before it, we’re releasing Swift Collections to help incubate new functionality for the Swift Standard Library.

The Swift Standard Library currently implements the three most essential general-purpose data structures: Array, Set and Dictionary. These are the right tool for a wide variety of use cases, and they are particularly well-suited for use as currency types. But sometimes, in order to efficiently solve a problem or to maintain an invariant, Swift programmers would benefit from a larger library of data structures.

We expect the Collections package to empower you to write faster and more reliable programs, with less effort.

swift.org/blog/swift-collections/

Swift Collections is a new open-source package that adds advanced data structures like Deque, OrderedSet, and OrderedDictionary to extend the Swift Standard Library’s offerings beyond Array, Set, and Dictionary.

Deque enables efficient insertions and removals at both ends, OrderedSet combines Array’s order with Set’s uniqueness, and OrderedDictionary maintains key-value pairs in insertion order with fast lookups.

Designed as a testing ground for future standard library additions, it aims to improve code performance and reliability while adhering to strict criteria for reliability, runtime performance, and minimal memory use.


Category:

Tag:

Year: