Hi Renato!
This question is really about modules communication. Let’s say you are in Create Profile module and after all fields are filled you are presenting User Profile module. Somehow you need to pass data (username, profile picture, email etc.) to another module. UIKit is build in a way that you are creating new UIViewController inside another one (from Storyboard, nib or purely from code) then setting all the data directly to it by using properties. In our case it will be
profileViewController.username= “john doe”profileViewController.profilePicture = UIImage(“https://blahblah”) //etc.
and then presenting it using present(controller:) method. VIPER sees View (UIViewController) as a passive object which means it does nothing navigation or configuration related — that’s basically the whole point of VIPER’s separation of responsibilities! Communication is straightforward here: Interactor gets “raw” data and applies business logic to it -> then Presenter gets the result and transforms it into a View-friendly objects -> View displays it. Interactor->Presenter->View (in case when user responds in the View (ex. by pressing button) View->Interactor->Presneter->View). So chain Interactor->Presenter->View is like circle of life in The Lion King.
It feels natural to pass data to Interactor directly so circle of life will not be broken. If you pass data directly to Presenter you’ll need to move some business logic inside of it which breaks Single Responsibility principle.
Hope it helps!
