Swiftpack.co -  Package - EBGToo/SBBasics
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Basics is a collection of largely standalone Swift abstractions for Bag type.
.package(url: "https://github.com/EBGToo/SBBasics.git", from: "0.3.0")

Bags, Stacks, Queues, Lists, Heaps, Trees, Graphs

Basics is a collection of largely standalone Swift abstractions for Bag type.

License Language Platform Version



A Bag defines a minimalistic, narrowly-interfaced container protocol for an arbitrary number of specifically typed but otherwise arbitary Items. A Bag may hold numerous 'duplicate' items. Generally the ordering of items in a bag is upspecified and the contents of the bag are (meant to be) invisible. One does not sequence through the bag contents nor does one index into the bag. There are other Swift data structures that allow for sequencing and indexing.


A Stack holds elements according to a LIFO discipline. Elements are pushed onto the top of a stack and popped off of the top.


A Queue holds elements according to a FIFO discipline. Elements are enqueued and dequeued.


A List holds elements according to a LIST discipline whereby the list is wither Empty or contains an Item as the car (aka head) and another list as the cdr (tail).


A Heap stores items according to a 'Priority Heap' discipline based on a ordering defined for Comparable items


A Ring hold items according to a RING discipline whereby items are put to the tail of the ring and get from the head of the ring. If the ring is filled to capacity, then put will discard the oldest item.


A Tree holds items items according to a rooted TREE discipline.


A Graph is a set of Items (as Nodes) connected to one anther (with Edges, possibly weighted).


Access the framework with

import SBBasics


Three easy installation options:

Apple Package Manager

In your Package.swift file, add a dependency on SBBasics:

import PackageDescription

let package = Package (
  name: "<your package>",
  dependencies: [
    // ...
    .Package (url: "https://github.com/EBGToo/SBBasics.git",  majorVersion: 0),
    // ...

Cocoa Pods

pod 'SBBasics', '~> 0.1'


$ git clone https://github.com/EBGToo/SBBasics.git SBBasics

Add the SBBasics Xcode Project to your Xcode Workspace; you'll also need the SBCommons package as well


Stars: 0
Last commit: 5 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco