December 2018
Intermediate to advanced
414 pages
10h 19m
English
In the view layer, we originally had a QuestionView, responsible for printing the question in the console, as well as a PromptView. Both can still live in our new model. They had simple interfaces, and were completely stateless, as follows:
struct QuestionView { func show(question: Question) { print(question.question) }}struct PromptView { func show() { print("> ", terminator: "") }}
We also have ViewController. This class is our main entry point for the View layer. It will keep its responsibilities, ask the questions, gain user input features, and bind the viewModel. We can call it MainView:
class MainView {private let questionView = QuestionView()private let promptView = PromptView()
Initialization will now require to pass ViewModel ...
Read now
Unlock full access