Network layer is very common and essential part of modern mobile apps. It usually takes the form of a manager class that takes care of every network request throughout your app.
Considering the separation of concern, a good networking layer is usually decoupled from the view code. Logic controllers or view controllers use the network manager to request certain API calls for example, and subsequently get a callback once the request succeeds or fails to reflect the result to the views. So ideally, the network manager should never know anything about the views.
There’s a very unique situation that makes this separation of concerns difficult. When you get an error from the network, like 404 or 500, and you need to show some kind of alerts to the user with a proper error message. This error should show the same UI regardless of where this network manager is called. The code often lives in one place, and usually it’s the root view controller of the whole app. How would you get a reference to the root view controller from the network manager, when the network manager is being called from a view controller deep down in the view hierarchy? …