Introduction
When we author an app, considering what data it needs to store, or keep track of, is a key skill.
Imagine that you were writing an app to present an electronic version of hockey trading cards.
What structure(s) would you design to do this?
Exercise
Here is a close-up of a retro-style hockey card for an imaginary player.
Here is an image of several similar cards.
Make a new Xcode playground named HockeyCards.
Write structure(s) in your playground to describe the data shown in the hockey cards.
Then create instances of your structure for at least three hockey cards.
TIP
Use the keyboard shortcut Command + to zoom in on the images in your web browser.
Getting started
We are a busy school. Some of you were absent when this exercise was introduced – or Mr. Gordon was absent. Whether you were absent or not, optionally, have a look at this brief video which demonstrates some important keyboard shortcuts and Xcode features that make this exercise easier to complete without creating syntax errors:
Next, here is a tip about how to best model the card so that you do not end up repeating yourself – watch this to learn how to use a nested structure: