Swift-VIPER-Module icon indicating copy to clipboard operation
Swift-VIPER-Module copied to clipboard

Coupling in domain layer

Open artjimlop opened this issue 8 years ago • 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.

artjimlop avatar Aug 10 '17 06:08 artjimlop

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.

SergeyPetrachkov avatar Feb 28 '18 01:02 SergeyPetrachkov