Blackjack with Swift Playgrounds

Blackjack with Swift Playgrounds

In this course your students will learn how to create a simple Blackjack game on your iPad using the Swift Playgrounds application and Swift 3.  Whilst this project doesn't follow strict Blackjack rules it can easily be extended by students if they want to split decks or develop it into an app that can deploy it to their iPads.  


This course teaches students how to use and implement objects within the UIKit Framework.  The UIKit Framework is fundamental to students developing applications and provides the crucial infrastructure needed to construct and manage iOS window and view architecture needed to manage an app's user interface, the event handling infrastructure needed to respond to user input, and the app model needed to drive the main run loop and interact with the system.  UIKit also provides the necessary framework for handling User Input and Gestures.

Level of Difficulty

The course is designed for learners who have had previous exposure to coding.  Not necessarily Swift, but they must have an understanding of the basic control structures and functions.  Through the course they will be introduced to more advanced topics such as Objects, Structures, Methods and Classes.

I have delivered this course to students aged between 13-16 years old with good results.

Course Structure

The course is designed to be very visual and get students creating rather then reading and learning about the theoretical elements of coding.  Additional reading, video and support material and provided to supplement the challenged.

The challenges themselves within the courses are designed to be slightly ambiguous to encourage students to ask intelligent questions, research solutions and scaffold their learning.  It's not designed to be a tutorial.

UIKit Introduction

Within the UIKit Introduction topic students learn about the individual objects within the UIKit framework and how to manipulate the object's properties and display the values. They will learn about the following objects specifically:

  • UIButton()
  • UIView()
  • UILabel()
  • UISlider
  • UIAlertController()


Within the Cards topic students will apply what they have learnt about UIKit objects to construct a little project which utilises an Array to simulate a deck of cards.  The deck is shuffled and they return a random card when a button is pressed.  At the end of the topic they will create a UIAlertController() to display a warning when the card values are over 21.


In the final topic the students apply the knowledge they have gained to build a little Blackjack game.  They are also introduced to Structs and Methods very gently to start thinking bout how they can reuse their code for other projects.

Accessing the Materials

All of the materials for this course are available through iTunesU and are publicly available under Creative Commons should you wish to re-use them for your own lessons.  I appreciate and encourage any feedback and constructive criticism so I can improve my courses.

Sprite Invaders with Swift Playgrounds

Sprite Invaders with Swift Playgrounds

Developing Swift Playgrounds Course Material

Developing Swift Playgrounds Course Material