April 2021
Beginner to intermediate
506 pages
11h 57m
English
When a player makes a purchase, you’ll need some way to store that information. What better way than to use the GameData class you’re already using to save the number of free continues? You added this class to the gloopdrop project in Save and Load the Number of Continues.
In the Project Navigator, select the GameData.swift file. Below the freeContinues property, add a new variable, like so:
| | var products = [StoreProducts.Product]() { |
| | didSet { |
| | saveDataWithFileName("gamedata.json") |
| | } |
| | } |
This new property stores an array of StoreProducts.Product objects. These objects represent the player’s purchases. Also, as you did with the freeContinues property, any time a change is made to ...
Read now
Unlock full access