Cleaner Swift Architecture

Palmeral de las sorpresas — Pier one — Málaga

Worker should not be a place to request all use case of a scene

We could think, basing on the flow scheme that Worker is the place where we should implement functions to ask our API Manager to fetch the data (API calls or local DB fetching) but actually this is not a good solution for a Clean Architecture. In many cases, the ViewController shows more than one simple use case to the user. In fact, is very common to find a screen where user can get/add/edit/delete different types of data at the same time (Show a profile and recent posts *). because of this, if we used the Worker to handle different use cases for different type of data, we would be creating a non-reusable massive piece of shitty code, and it smells.

Worker for show profile and posts

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Francisco Navarro

Francisco Navarro

iOS Software Engineer 🍎 — Fan of Domotics