Michael Williams

Using Result with Network Requests

Michael Williams | Apr 22, 2019

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

Subscribers Only

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

Subscribers Only

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

Need Help?

If you get stuck, try starting a discussion with Big Nerd Ranch experts in the community tab.

Related Screencasts

Explore other screencasts related to this topic.