A swift 5 client implementation of DeckOfCardsAPI
Generated using Swaggerhub
If you're running an Xcode project:
- select
File
->Swift packages
->Add Package Dependency...
, - add this repo's git file
[email protected]:ThumbWorks/DeckOfCards.git
in the text box - pin the the appropriate version,
1.0
for instance. - add
import DeckOfCards
DeckAPI.newDeck { (deck, error) in
if let deck = deck {
print("we got a deck \(deck) with ID \(deck.deckId) and \(deck.remaining) cards")
}
if let error = error {
print("error \(error)")
}
}
DeckAPI.shuffleExistingDeck(deckId: deckId) { (deck, error) in
if let deck = deck {
print("shuffled: \(deck.deckId)")
}
if let error = error {
print("error \(error)")
}
}
PileAPI.addToPile(deckId: deckID,
pileName: pileName,
cards: cards.map({ card -> String in
return card.suit + card.value
}))
{ (deck, error) in
if let deck = deck {
print(deck.piles)
}
if let error = error {
print(error)
}
}