OSS TanbouSign in with GitHub

extend Swift with Deque, ordered collections, heaps, and other specialized data structures

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
4,515
Primary language
Swift
License
Apache-2.0
Repository last updated
Oct 1, 2026
On this page

Overview

Swift Collections is an open-source package of data structures for Swift. It provides modules for deques, ordered sets and dictionaries, bit collections, heaps, persistent hash-tree collections, and other containers that complement the standard library.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Choose Deque, ordered collections, heaps, and other structures by module

DequeModule provides ring-buffer deques, OrderedCollections preserves insertion order for sets and dictionaries, and HeapModule provides a min-max heap suitable for priority queues. Applications can depend only on the modules they need.

Sources: [2]

Use persistent collections and ownership-aware containers when needed

HashTreeCollections provides CHAMP-based persistent sets and dictionaries, while BasicContainers includes ownership-aware variants of common generic collections.

Sources: [2]

Best fit

Fits Swift code with explicit queue, ordered-map, or priority-queue requirements

It is useful when a specialized data structure offers clearer complexity, ordering, or memory semantics than implementing the same behavior on top of Array, Set, or Dictionary.

Sources: [2]

Before adoption

Version 1.7.1 uses Swift tools 6.2 and includes a Swift 6.4 deployment workaround

Package.swift uses Swift tools 6.2. Release 1.7.1 works around a Swift 6.4 defect that prevented code using the package from deploying to macOS/iOS versions before 27, so Swift 6.4 users should use 1.7.1 or newer.

Sources: [3][4]

Official sources

  1. [1]apple/swift-collections — GitHub repository(2026-10-06)
  2. [2]Swift Collections 1.7.1 — README(2026-10-06)
  3. [3]Swift Collections 1.7.1 — Package.swift(2026-10-06)
  4. [4]Swift Collections 1.7.1 release(2026-10-06)
  5. [5]Swift Collections Apache-2.0 license(2026-10-06)
Supplemental curator note

Swift Collections fits code with explicit queue, ordered-map, priority-queue, or persistent-collection requirements. Swift 6.4 users should use 1.7.1 or newer for its deployment workaround.

Try it in 3 steps

  1. 1

    Add Swift Collections 1.7.1 with SwiftPM

    Pin 1.7.1, which includes the Swift 6.4 deployment workaround.

    .package(url: "https://github.com/apple/swift-collections.git", exact: "1.7.1")
  2. 2

    Add DequeModule to the target

    Link only the data-structure module the target needs.

    .product(name: "DequeModule", package: "swift-collections")
  3. 3

    Use Deque as a FIFO queue

    Use the ring-buffer-backed Deque for tail insertion and front removal.

    import DequeModule var queue: Deque<Int> = [1, 2] queue.append(3) let first = queue.popFirst()
Check the official README

Growth

Growth trends · Last 30 days

4,515 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
66
Open PRs
26

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • collection
  • container
  • deque
  • dequeue
  • hash
  • ordered-dictionary
  • ordered-set
  • sequence
  • queue
Stars
4,515
Forks
416
Watchers
148
Open issues
50
Contributors
84
Owner type
Organization
Primary language
Swift
License
Apache-2.0
Repository last updated
Oct 1, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?