Skip to content
Basic implementation of a generic stack type that uses copy-on-write
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This SPM package contains a very basic implementation of a generic Stack<Element> type that has value semantics and uses copy-on-write (COW) to improve its performance. Therefore, it works similarly to the collection types from Swift's standard library (e.g., Array<Element>, Set<Element>, String).

There is an accompanying blog post for this repository:


This repository was only created to demonstrate Swift's copy-on-write mechanism with an example. It has various limitations and is not supposed to be used in production. If you ever want or need to create a Stack type you should probably just wrap a regular Swift array (or use the array directly).

You can’t perform that action at this time.