I want you to mentally imagine what the code would look like if we continued building out our story in this fashion. There would be lots of if statements and the code would get more and more confusing. At which point we might just give up.
Let’s see how MVC can come to the rescue to improve the scalability of our app.
Create a Structure in the StoryBrain.swift file called StoryBrain.
Move the storyNumber and stories Array into the StoryBrain.
Create a method (a function associated with an object) in the StoryBrain that’s called nextStory(), it should take a single input called userChoice which is of type String.
Move the story progression functionality that currently lives in the choiceMade() IBAction into the nextStory() method.
Create a new instance of StoryBrain in the ViewController.swift to be able to tap into the newfound capabilities of the StoryBrain, call it storyBrain.
Use the storyBrain to determine which story to show when the user makes a choice.
Use the storyBrain to provide the story title and choice text.
Make sure there are no more errors, but the functionality should be the same as the version you had at the end of Step 4.