Jul 10, 2017 · 1 min read
It depends on the nature of the app I guess. Some interact with API frequently and some don’t. You’re right, if you need a function in 18/19 screens it’s better to implement it in UIViewController extension.
Also, handleError function that accepts Error protocol is a great idea and it’s actually how we do it 😀 It allows us to parse error, decide if it’s meant for user and even localize it.
handleError function presented in the article is just an example. Try not to think of my post as an error handling tutorial but rather a protocol oriented programming one. Instead of showing error alert it could just as well be fetching some data from API in two view models, showing news fetched from API only on chosen screens etc.
