I've been looking into applying the Model View Presenter architecture to a new iOS project. After some reading, I found that this post had the best example. Link to raw gist of code here.
The bottom of the example has the assembly code:
// Assembling of MVP
let model = Person(firstName: "David", lastName: "Blaine")
let view = GreetingViewController()
let presenter = GreetingPresenter(view: view, person: model)
view.presenter = presenter
Furthermore, the author states:
Since we don’t want the View to know about the Model, it is not right to perform assembly in presenting view controller (which is the View), thus we have to do it somewhere else. For example, we can make the app-wide Router service which will be responsible for performing assembly and the View-to-View presentation.
My question:
- Where should I put the assembly code?
- Would putting the assembly code in app delegate give me two ViewController classes?
- Where can I find more example of an app-wide router?
