Swift Collections is an open-source package of data structure implementations for the Swift programming language.
Read more about the package, and the intent behind it, in the announcement on swift.org.
The package currently provides the following implementations:
Deque<Element>, a double-ended queue backed by a ring buffer. Deques are range-replaceable, mutable, random-access collections.
OrderedSet<Element>, a variant of the standard
Setwhere the order of items is well-defined and items can be arbitrarily reordered. Uses a
ContiguousArrayas its backing store, augmented by a separate hash table of bit packed offsets into it.
OrderedDictionary<Key, Value>, an ordered variant of the standard
Dictionary, providing similar benefits.
The following data structures are currently being worked on but they aren’t ready for inclusion in a tagged release:
PriorityQueue, min-max heaps backed by an array.
SortedDictionary, sorted collections backed by in-memory persistent b-trees.
HashMap, persistent hashed collections implemented as Compressed Hash-Array Mapped Prefix-Trees (CHAMP).
BitSet, dynamic bit vectors.
SparseSet, a constant time set construct, trading off memory for speed.
Swift Collections uses the same modularization approach as Swift Numerics: it provides a standalone module for each thematic group of data structures it implements. For instance, if you only need a double-ended queue type, you can pull in only that by importing
OrderedDictionary share much of the same underlying implementation, so they are provided by a single module, called
OrderedCollections. However, there is also a top-level
Collections module that gives you every collection type with a single import statement:
import Collections var deque: Deque<String> = ["Ted", "Rebecca"] deque.prepend("Keeley") deque.append("Nathan") print(deque) // ["Keeley", "Ted", "Rebecca", "Nathan"]
Mobile \ Read more \ 27.09
iOS SwiftUI Lists Are Broken And Can’t Be Fixed Swift Combine: Understanding Publisher-Subscriber Pattern in 2 seconds How to Create...
Mobile \ Read more \ 26.09
iOS Compose UI for iOS Aspect Fit Layout Guide Replacing if let in Swift 5.7 Native iOS Game Development w/...
Dotlin – Kotlin to Dart compiler
Dotlin is a Kotlin to Dart compiler. The aim is to integrate Kotlin as a language into the Dart ecosystem,...
Koreography – A light weight Compose Animation library
A lightweight Compose Animation utility library to choreograph low-level Animation API through Kotlin DSL. It does the heavy lifting of dealing...
Mobile \ Read more \ 22.09
iOS Understanding Swift’s Opaque Types Implement Core Spotlight in a SwiftUI App MVVM + POP to deal with complex UI...
Dynamic Islands – A sample of Dynamic Island designs
A sample of Dynamic Island widgets that will help you make better things! Dynamic Islands This repo aims to provide...