Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do notifications fit in iOS VIPER architecture?

I was looking at VIPER architecures and I was wondering where notifications would go in the app. I use Realm local database which has the ability to send notifications when models are updated. Do notifications get broadcasted from the INTERACTOR --> PRESENTER --> VIEW or does it go somewhere else?

like image 524
Nader Besada Avatar asked Oct 28 '22 22:10

Nader Besada


1 Answers

In this scenario Realm would be used as a data service, providing data. Accordingly, such as service is best placed in the interactor.

Then, as you say, events from the interactor can be passed to the presenter and them to the view, where you might want to reload a tableView or some such task.

I tend to pass the Realm results from the interactor to the presenter where I expose a variable for the view to use and update this in the callback from the interactor.

like image 158
Scott McKenzie Avatar answered Nov 08 '22 15:11

Scott McKenzie