Interface Controller
Next we go through the same process with the interface controller, namely planning out what we think it will need to do (remembering that an incomplete plan is good enough at this stage) and stub the methods that we expect to need.
Planning the interface
The InterfaceController
class will act as the CONTROLLER of communication between the user interface—the VIEW—and the actual implementation of the game—the MODEL. It needs to inform the player what the game is doing and inform the GameLogic
class what the player is doing.
So, very roughly, the controller will need to do the following:
- Accept the player's instruction to start the game
- Flash the colors in sequence
- Accept player input
- Enable and disable user input as required
- Show results when a game is over
- Start a new game
Define Outlets to the View
Add the following declarations to the top of the InterfaceController
class (not the top of the InterfaceController.swift
file):
class InterfaceController: WKInterfaceController...