Chapter 11. Asynchronous error handling with Result

This chapter covers

  • Learning about the problems with Cocoa style error handling
  • Getting an introduction to Swift’s Result type
  • Seeing how Result provides compile-time safety
  • Preventing bugs involving forgotten callbacks
  • Transforming data robustly with map, mapError, flatMap, and flatMapError
  • Focusing on the happy path when handling errors
  • Mixing throwing functions with Result
  • Learning how to use errors dynamically with Result
  • How to show intent with the Never type

You’ve covered a lot of Swift’s error handling mechanics, and you may have noticed in chapter 6 that you were throwing errors synchronously. This chapter focuses on handling errors from asynchronous processes, which is, ...

Get Swift in Depth 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.