Reputation: 389
I am creating a chat application and I have a listener set up that listens for new messages broadcasted by users. The listener starts in applicationDidBecomeActive
. Normally in Viper, UI action happens in the View, the Presenter gets notified and calls an Interactor function which does some sort of network/local logic and passes it back to the Presenter which then updates the View.
How does my listener fit into all that?
How is my View notified whenever a new message is received?
Upvotes: 2
Views: 165
Reputation: 16242
I would suggest a multicast mechanism som multiple modules/views can attach and receive events.
On the VIPER side you're likely to have a root VIPER module/object that creates children. The listener object you create can be passed to child modules that can attach/detach to the listener as required.
Upvotes: 1