Implementing the methods
Take a deep breath, we don't run the code for a while!
We will start with our InterfaceController
class. This is where the user's engagement with the app begins, and this is where we will begin to endow the classes with life.
When the app launches, it automatically loads the view that is designated as the Main Entry Point, identified in Interface Builder by the Main arrow, as shown in the following figure:
In our case, this main entry point is the InterfaceController
class.
The InterfaceController class
In addition to performing duties of its own, InterfaceController
creates two objects on which it must call. Firstly, an instance of our GameLogic
class and secondly, an instance of NSTimer
with which we will control the timing of the flashing colors.
In contrast to some languages, in Swift we can both declare these properties and instantiate them at the same time. Add the following code to the InterfaceController
class below the IBOutlet
declaration:
@IBOutlet...