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.
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
.
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.
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.