FortechRomania / ios-mvp-clean-architecture

Demo iOS application built to highlight MVP (Model View Presenter) and Clean Architecture concepts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Where would you define `TaskManager` protocol and its implementation?

zigdanis opened this issue · comments

Thank you for this awesome example project!
I'm interested how would you name and where would you put a protocol and its implementation that can queue and manage multiple tasks with final completion callback, pausing, retrying and etc. Some kind of abstraction for NSOperation or GCD.
Does that counts as iOS specific framework? Or is it Application Logic UseCase? Or maybe Application Logic Gateway?

Hi,

Thank you for your feedback.

It's a good question that shows the limitations of trying to structure the codebase around a predefined number of layers. In reality things are always more nuanced and you end up with multiple components that don't always fit in these predefined layers.

What you're describing resembles something that might even be baked into the platform (e.g. supposedly Foundation would expose a Task API just like it exposes NSOperation API).

So probably, one approach that I would take, would be to create some sort of Task.framework and reference it in my UseCases if it turns out that the UseCases are the only ones that need to leverage the Task API.

Regards,
Cosmin