Explore Library
Quiz

Handling Loading and Error States in URLSession

Learn how to model loading, success, and error states when fetching REST data with URLSession.

You fetch JSON from a REST API using URLSession's dataTask. Which check correctly detects an HTTP-level failure (e.g. a 404 or 500 response) before decoding the data?