This is part of the "iOS Data and Networking" learning path. View Path

Networking with URLSession

Jun 9 2020 · Video Course (3 hrs, 23 mins) · Beginner

Learn how to use URLSession, Apple's networking API, including when and how to use data, download and upload tasks, with or without a custom session delegate, and how the system manages background sessions and WebSockets. Leverage the Combine API and SwiftUI to take your networking to the next level. Updated for iOS 13 and Swift 5.2.

5/5 4 Ratings

Version

  • Swift 5.2, iOS 13, Xcode 11

Concurrency and DataTasks

Introduction

5:37 Free

Learn about the URLSession and how the framework evolved in the way that it did. Also learn about the course goals.

1

Get an overview of why concurrency is important and how ignoring it can create a terrible user experience.

2

In this episode, get a brief overview of the various options in iOS and see them in action.

3

This challenge will put your understanding of concurrency to the test by updating the user interface from an operation queue.

4

Learn the basics of Session Configuration and how you can use the configuration to modify your session's behavior.

5

This episode covers the basics of working with sessions and how to use session data tasks to fetch remote data.

6

Now that you have an idea of how to create a session, your challenge is to create your own session and fetch artwork from over the network.

7

Conclusion

1:56

Review the concepts covered in this part and preview the next part of the course.

8

Downloading and Uploading

Now that you understand the data task, learn how to put the download task and upload task to use.

9

Working with tasks often means setting priorities and figuring out what to cache. This episode covers what you need to know.

10

In this episode, put the download task to use by downloading music from iTunes preview API.

11

Put your downloading skills to the test by downloading some album artwork and displaying it on the screen.

12

In this episode, learn how to display download progress as a file is downloaded.

13

You have lots of different tools to simulate poor network connections. This episode will show you a few of them.

14

This episode covers the process of pausing, canceling and resuming downloads.

15

Vapor is an open source server written entirely in Swift. In this episode, learn how to install the server.

16

Learn how to upload data to a local vapor instance.

17

Conclusion

1:45

This episode concludes the part on downloading and uploading, but things are just starting to get interesting

18

Background Downloading and WebSockets

This episode introduces the concept of background downloading and WebSocket communication.

19

Learn about the background task, how to use one of them and then how to handle background events.

20

This episode gives you an overview of BSD sockets and explains how Apple's Networking framework works for you.

21

Use the new WebSocket task to connect a local Vapor server to send messages and then use them to create a chat server.

22

Conclusion

0:52

Review all the concepts covered in this part and then learn about upcoming topics.

23

URLSession and Combine

Combine is a native reactive framework that released with iOS 13. Learn how URLSession has been updated to use it.

24

This episode provides an overview of the general concepts behind the Combine framework.

25

Learn how to use a data task with Combine and then how to access the data through a variety of operators.

26

With the use of Zip, learn how to group multiple requests together.

27

Learn how to make a urlrequest once another request has finished.

28

Put your Combine skills to the test by fetching a list of album titles and printing the results out to a list.

29

Learn how handle errors when something goes wrong during URLSession

30

Conclusion

0:49

This concludes this part on Combine but there's more to learn in the final part of this course.

31

Authentication, ATS and Cookies

This final part of the course covers a variety of important topics that you will need to know when making network requests.

32

This episode covers the various different ways to provide authentication when working with URLSession.

33

iOS provides some important security mechanisms when making requests on iOS. This episode shows how ATS can affect your app.

34

Learn how read cookies and write cookies from a URLSession

35

In this challenge, learn print cookies from raywenderlich.com

36

Conclusion

2:04

This final episode concludes the course while providing several resources on where to learn more about URLSession.

37

Who is this for?

Intermediate developers. You should be comfortable with the Swift programming language and up to speed on the SwiftUI framework. You should also have some working knowledge of the Combine framework.

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 and upload files and how to set up background sessions. Ultimately, you'll leverage the power of the Combine framework to make your requests.

Finally, you'll learn about authentication, Apple's Transport Security and reading and writing cookies.

Covered concepts

  • URLSession Configuration
  • URLSession Connections
  • Downloading Files
  • Uploading Data
  • Pausing, Resuming and Canceling Data
  • Showing Network Progress
  • Simulating Different Network Speeds
  • Vapor Framework
  • Background Downloading
  • WebSockets
  • URLSession and Combine
  • Authentication
  • Application Transport Security
  • Cookies

Contributors

Comments