The deck-of-cards enumeration keeps coming up over and over again in #swift-lang because of the Swift Programming Language guided tour. I recently decided to create my own deck. I started on this because I wanted to test out some of GameplayKit features, namely shuffling, but also because I wanted to play a bit with CustomStringConvertible and CustomPlaygroundQuickLookable.
My goal was actually to build card views, shuffle a deck, and fan out the results. What I found was that the Unicode deck characters won’t render properly to UIKit contexts, where GameplayKit is freely available, and will to OS X ones, where GameplayKit isn’t. (I’m still primarily on Yosemite, not El Capitan.)
I filed some radars, created a post, and put my implementation to the side. Then Maximilian tweeted.
@ericasadun awesome:) I was able to make it, but I’m curious if your implementation of the card class is different than mine.
— Maximilian (@maxhasadhd) June 22, 2015
So here’s a developer challenge. Have at the deck enumeration, have some fun, and share your implementation on github. When you’re ready to peek, here’s mine.
One Comment
Hello Erica,
One question: Can you really shrink
——————————-
——————————-
with:
——————————-
——————————
can you link some documentation?
Thank you for your work and your books, they are precious.