While our app works at the moment and we’ve adopted the gold-standard MVC design pattern, we can still improve the scalability of our code. If we were to continue building out the storyline, we would have to manage all the logic using our IF/ELSE statements, which is already getting confusing. Let’s move the logic into the Story struct instead.
Head over to the readme file and copy over the Story Strings. Replace what’s currently in the stories Array with the new Strings.
Create another two properties in the Story struct: choice1Destination and choice2Destination to silence the errors in the stories Array.
Instead of setting the storyNumber in the nextStory() method, use the choice1Destination as the storyNumber if the user chose choice1 and do the same for choice2. Check against the story outline on the next page to see if your app behaves as expected.
Story Outline (pdf available under the lesson resources)
GOAL