Juanpe/Swift-VIPER-Module

Coupling in domain layer

artjimlop opened this issue · 1 comments

I tested this template some weeks ago and I found the Interactor has a reference to the presenter. Conceptually, I find it wrong. The domain layer should be as decoupled as possible from the presentation and data layer.

The most common approach is making the presentation and domain layers communicate trough callbacks, so the interactor doesn't know to wich presenter is related.

Probably you already know this but just in case I tell you: think in the interactor like a lego piece. You should be able to change the piece you have over it (presenter in this case) without touching a single line.

Interactor should communicate with presenter by Protocols.

Presenter should pass calls though InteractorInputProtocol and receive Interactor answers through InteractorOutputProtocol which the presenter should conform to.