Hi,
I ask myself about its necessary if I use useCase
pattern with a MVVM architecture and repositories. Initially the viewModel
comunicate with the repository directly.
So if I want to add a UseCase
layer, the viewModel will communicate with the useCase
and the useCase
with repository.
Why useCase
is a class, I could get the same result with protocol?
protocol AddUseCase
protocol FetchUseCase
The only reason I see to create a UseCase
class is to add a validation logic (instead of it in the ViewModel) before continuing to repository.