Better error handling

The simplest way to handle an error is to display a message, which appears on top of everything. It blocks the rest of the UI and steals the user's attention. This is not the most elegant way, because it's very intrusive, but it's perfect in cases where we have to bring something really critical to the user. For example, when the weather app is trying to fetch the forecast from the server and there is a problem with the network or with the server's response, the app won't be able to receive any data and the user should know what the cause is.

When presenting such important information, use the user's language. Don't use technical information such as the number of the error or something which is pretty specific. Try to ...

Get Learn Swift by Building Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.