You may have realized that the tutorial reappears every time we rerun the game even if it has been completed previously. Now that we know how to store information on the device, let's take advantage of it in order to store information about whether the tutorial has been completed.
We will need a couple of new variables to support this new behavior. Therefore, add the following lines at the top of
private var isTutorialCompleted: Bool = false private var kUserDefaultTutorialCompleted = "user_default_tutorial_completed"
We declared a Boolean variable that will act as a
flag that represents the user's
default value. We also declared a constant that will be used to identify the value ...