Using Result with Network Requests

By Michael Williams on Apr 22, 2019


About

How do I use Result type in networking code?

When working with networking code, most APIs send back optional types (usually an error and one or two other types such as a response and data), but there is no compile-time guarantee that all of these will not be nil.

In today’s screencast I will be showing you how to use Swift 5’s new Result type in our networking APIs to make them cleaner and easier to reason about.

After this screencast, you'll be able to implement the Result type in asynchronous/networking APIs instead of optionals.

Prerequisites:

  • Xcode 10.2+ installed
  • Basic knowledge of completion handlers
  • Knowledge of how to implement URLSession

For the More Curious...

Result | Apple Documentation
BNR Guide to iOS
BNR Guide to Swift
iOS & Swift Courses

Transcript

Transcripts are only available for subscribers. Create an account today to access our collection of screencasts, skill packs, and more.

Downloads

Project files are only available for subscribers. Create an account today to access our collection of screencasts, skill packs, and more.

Comments