Deck 0.1.0

Deck 0.1.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Mar 2015
SPMSupports SPM

Maintained by Matthew Palmer.



Deck 0.1.0

  • By
  • matthewpalmer

Deck

A generic Deck type, like a deck of cards or a slide deck.

A Deck is similar to a Stack, except that you can go forwards and backwards through it. When you get to the end of a Stack, it loops back around to the start.

Usage

Create a new Deck with the provided ‘Cards’, where 'Cards’ are really anything.

let firstFive = Deck(cards: [1, 2, 3, 4, 5])

Move forwards and backwards through the Deck

firstFive.currentCard()  // == 1
firstFive.nextCard()     // == 2
firstFive.nextCard()     // == 3
firstFive.previousCard() // == 2
firstFive.previousCard() // == 1

Requirements

This is implemented in Swift, so iOS 8.0+ is required.

Installation

Author

matthewpalmer, [email protected]

License

Deck is available under the MIT license. See the LICENSE file for more info.