Clean-Swift/CleanStore

Same interface

Opened this issue · 4 comments

I see that there are same methods in the 2 protocols

ViewControllerInput == PresenterOutput
PresenterInput == InteractorOutput
InteractorInput == ViewControllerInput

for example

protocol CreateOrderViewControllerOutput
{
  var shippingMethods: [String] { get }
  func formatExpirationDate(request: CreateOrder_FormatExpirationDate_Request)
}
protocol CreateOrderInteractorInput
{
  var shippingMethods: [String] { get }
  func formatExpirationDate(request: CreateOrder_FormatExpirationDate_Request)
}

Can we remove the Input protocol? If Interactor wants to be ViewController 's output, it needs to conform to ViewControllerOutput. This a little coupled is no harm because they are in the same module/component

How do you think ?

While on a technical case they are the same, I agree with the duplication and decoupling of these. I think of it a lot along the lines of double-entry bookkeeping....it helps to keep everything in-check, decoupled and isolated. In my experience, it also improves reusability and makes it somewhat easier when it comes to writing unit tests.

I'm currently using this process on a large Obj-C app, which currently has 27 scenes (will probably end up with about 60 scenes) and 19 different "workers". There are a lot of steps in this process that could be optimized out, but I found them to be valuable in keeping the app "clean" and wouldn't recommend any such consolidation (in my experience).

This question is very interesting and did not get yet the positive site of having Input and Output protocols. Could someone explain a bit more the positive effects of it?

templates have been updated, check it out, now there isn't anymore that duplication of protocols :)

@rayvinly ping ping 😛