Session 4

Tic Tac Toe

Session Materials

Case Study Resources



Link for assignment repo right here

In this assignment, you will create a tic tac toe game. The game should be designed for two players to play against each other on a single device. You will use UIGestureRecognizer, UIViewPropertyAnimator, CALayer, UIBezierPath, and optionally, CABasicAnimation.

Project Setup

Initial User Interface

Grid View

Tip: Your nine views do not need to be subviews of the grid view.

X’s and O’s

Tip: User interaction is NOT enabled by default on labels and image views, so you will need to enable it.

Initial layout.
Initial layout.

Instructions View

Instructions view.
Instructions view.

Game Play

Start of a Turn

During a Turn

frame1.intersects(frame2) // returns a boolean

End of a Turn

Game End

Declare a Winner or Tie

Declaring a winner.
Declaring a winner.

Clear the Board

Grid Model

let grid: Grid = Grid()
Tip: Remember that "Grid" is not the same as "GridView". Model and view are represented by different classes, both of which are managed by the controller.

Extra Credit

Animate drawing this line for extra credit.
Animate drawing this line for extra credit.

App Icon


We will add your grade to your repository in a branch named “Grade.”