December 2018
Intermediate to advanced
414 pages
10h 19m
English
Now that we have the model layer properly defined, let's take a look at the view layer. From here, we'll need to somehow display the current question.
We'll have a QuestionView, responsible for printing the question in the console, but it could also be responsible for a label on-screen in another scenario. We'll also have a PromptView, which will be used to display the prompt for the user to answer.
Finally, we'll have a ViewController, responsible for providing a simple interface that properly displays every question and prompt on-screen, as well as responding to the user on whether their answer was correct:
struct QuestionView { func show(question: Question) { print(question.question) }}struct PromptView { func show() {
Read now
Unlock full access