Beginning Networking with URLSession

Learn how to use URLSession, Apple’s networking API, including how to download data, show download progress, group multiple network requests, handle errors, and more. Learn about concurrency and how it plays a role in networking, perform downloads. Updated for iOS 15 and Swift 5.6. By Felipe Laso-Marsetti.

2.9 (15) · 9 Reviews

Download materials
Save for later
Comments
Share

Learning path

This is part of the iOS Data & Networking learning path. View path.

Who is this for?

Intermediate developers. You should be comfortable with the Swift programming language.

You’ll start by getting an overview of concurrency, then you’ll learn how to make simple network requests. Later, you’ll learn how to download files, how to group your network requests, show download progress, and handle errors.

Finaly, you’ll learn how to pause, cancel, and resume your downloads.

Covered concepts

  • URLSession
  • URLSessionConfiguration
  • Downloading Files
  • Pausing, Resuming and Canceling Downloads
  • Showing Network Progress
  • Simulating Different Network Speeds

Part 1: Introduction to URLSession & Concurrency

01
Toggle description

Introduction to the Beginning Networking with URLSession course.

Toggle description

Introduction to the modern concurrency features of Swift.

Toggle description

Continuing the coverage of Swift’s modern concurrency features.

Toggle description

In this challenge episode you will put your existing knowledge about Swift concurrency to the test in order to ensure some code runs on the main thread.

Toggle description

Learn about URLSessionConfiguration and how to leverage it to modify your URLSession’s behavior.

Toggle description

Learn to work with URLSession and how to use it to download data from a server.

Toggle description

In this challenge episode you will put your existing knowledge about URLSession to the test in order to download and display data downloaded from the network.

Conclusion 1:22
Toggle description

Wrap up the first part of the course and review the learned contents.

Part 2: Download Data

Toggle description

Introduction to part 2 of the Beginning Networking with URLSession course.

Toggle description

Take a look at how tasks oftentimes require different priorities, as well as defining what will be cached.

Toggle description

Apply the concepts learned in the previous lecture, regarding priorities and caching, in order to download music from the iTunes preview API.

Toggle description

URL requests can sometimes go wrong. Learn how to handle errors during networking operations.

Toggle description

Leverage the concepts learned in the previous lecture, but apply them towards downloading images corresponding to album artwork.

Toggle description

Performing lengthy uploads or downloads without any visual indication of progress is not the best user experience. This episiode will show you how to provide a progress indicator for a download.

Toggle description

Learn how to group multiple URLSession tasks so they execute concurrently, but are reported as completed when all requests have finished.

Toggle description

In order to deliver the best user experience you need to test your appls with the same types of network conditions that your users might encounter. This episode will show you how to simulate poor network connections.

Toggle description

Apps will likely run into scenarios that require a download or upload to be paused, resumed, or canceled entirely. This episode will cover these topics.

Conclusion 2:08
Toggle description

Wrap up the course and review the learned contents.

Up next

iOS & Swift
Advanced Networking with URLSession
Dive deeper into URLSession. Learn how to upload data and how to perform background downloads. Work with s... more

Instructors

Contributors

Ehab Amer

Tech Editor

Adriana Kutenko

Illustrator

Abigail Seperidad

Video Editor

Over 300 content creators. Join our team.