Eimantas
Eimantas
Jul 10, 2017 · 1 min read

So there may be controllers that don’t handle errors at all? I find that highly unlikely. IMHO in the project with around 20 VCs you may have maybe 1 or 2 of such controllers. So making 18/19 of them ErrorPresenting is a lot of redundant code.

Also not all errors passed to VC need to be presented. There can be other handling ways. So it’s better to have a method handleError that accepts an object conforming to Error protocol and not restrict yourself to craming two strings as attributes to UIAlertController. Abstracting the error type to Error and making all view controllers able to handle it is IMHO better than wondering about very few cases where error handling _might_ not be needed. The only pain can be the ability of the UIAlertController to present the error.

    Eimantas

    Written by

    Eimantas

    Developing on  platforms. Studying statistics & machine learning. Interested in writing, graphics design and photography.