Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 1.26 KB

README.md

File metadata and controls

33 lines (23 loc) · 1.26 KB

Strong reference to Presenter

Problem

The Presenter subscribe to the Store. The Store then keep a reference to the Presenter in order to notify it when the AppState has changed. However this is a weak reference. We need to keep a strong reference to the Presenter somewhere.

Solution

Rely on the ReSwiftRouter that keep a collection of Routable while having the Routable implemented by our module routers (Ex: RootModule). These module routers have a strong reference to both the Presenter and the ViewController.

UIKit lifecycle & ReSwift

Problem

The Presenter subscribe to the Store. The Presenter will be notified by the Store about the AppState. However the Presenter does not know the current state of the ViewController. Maybe the ViewController has not each the viewDidLoad state.

Solution

The ViewController could have a public state property of ViewModel type that the Presenter will change. The ViewController will be responsible of observing both this state property and also the viewLoaded property. Whenever state change and viewLoaded is true, then the render of the view should happen.