Swiftpack.co - Package - attaswift/Deque

A Double-Ended Queue Type in Swift

Swift 4.2 License Platform

Build Status codecov.io

Carthage compatible CocoaPod Version

Deque<Element> implements a double-ended queue type. It's an Array-like random-access collection of arbitrary elements that provides efficient O(1) insertion and deletion at both ends.

Deques are structs and implement the same copy-on-write value semantics as standard collection types like Array and Dictionary.


Deque on the master branch is compatible with Swift 4.2.



If you use CocoaPods, you can start using Deque by including it as a dependency in your Podfile:

pod 'Deque', '~> 3.1'


For Carthage, add the following line to your Cartfile:

github "attaswift/Deque" ~> 3.1

Swift Package Manager

For Swift Package Manager, add SipHash to the dependencies list inside your Package.swift file:

import PackageDescription

let package = Package(
    name: "MyPackage",
    dependencies: [
        .Package(url: "https://github.com/attaswift/SipHash.git", from: "3.1.1")


Stars: 48
Help us keep the lights on


Used By

Total: 1


v3.1.1 - Sep 30, 2018

This release updates the project for Swift 4.2 compatibility.

  • Disable CountableRange overloads in Swift 4.2 and above (#2, contributed by@kmiloaguilar)
  • Fix typo by renaming removeAll(keepCapacity:) to removeAll(keepingCapacity:). The old name is still available through a deprecated compatibility definition.
  • Fix deprecation warnings emitted by the Swift 4.1 and 4.2 compilers.

v3.1.0 - Sep 7, 2017

This release updates the project to Swift 4 with no functional changes.

Deque is now part of the Attaswift project. The bundle identifiers in the supplied Xcode project have been updated accordingly.

Note that the URL for the package's Git repository has changed; please update your references.

v3.0.0 - Feb 10, 2017

This release contains an API-breaking change, so the major version number was bumped. It is, however, very likely that your existing code using Deque will continue to work unchanged.

  • The SubSequence of Deque has been changed from RandomAccessSlice to RangeReplaceableRandomAccessSlice to adopt newly enforced requirements of RangeReplaceableCollection.
  • (Xcode project) The macOS deployment target was set to 10.9.
  • (Xcode project) Code signing was disabled, following Xcode 8 suggestions.
  • (Xcode project) App extensions are now able to link Deque's tvOS framework.

v2.0.1 - Nov 9, 2016

This release updates the project for Swift 3.0.1, restoring support for the Swift Package Manager.

v2.0.0 - Sep 20, 2016

This release updates the project for Swift 3.0, including adapting the API to the new naming conventions.

Furthermore, collection conformances were cleaned up. Deque now implements RandomAccessCollection. Deque.Indices is now simply a CountableRange<Int>, while Deque.SubSequence is RandomAccessSlice<Deque<Element>>.