SwiftStack

main

A Swifty implementation of the Stack data structure. (LIFO: Last-in, First-out)
DandyLyons/swift-stack

SwiftStack

SwiftStack is a simple stack implementation in Swift. This package includes a Stack struct which is a last-in, first-out (LIFO) data structure.

Usage

import SwiftStack
let stack = Stack<Int>()
stack.push(1)
stack.push(2)
stack.push(3)
print(stack.pop()) // 3
print(stack.pop()) // 2
print(stack.pop()) // 1

Installation

Swift Package Manager

Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/DandyLyons/swift-stack", from: "1.0.0")
]

Licensing

This stack implementation was originally released in the Swift Algorithm Club repository. It was originally released under the MIT license. See the original repo, kodecocodes/swift-algorithm-club for more information. You can find the original license in the swift-algorithm-club LICENSE.txt file.

I have made some modifications to the original code in order to make it a Swift package, and update to modern Swift. This repo is also released under the MIT license which you can find in the LICENSE.txt file in this repo.

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Tue May 13 2025 00:09:38 GMT-0900 (Hawaii-Aleutian Daylight Time)