There is an updated version of this course available, created for Swift 5.2, iOS 13, Xcode 11. View Latest Version

Networking with URLSession

Mar 21 2017 · Video Course (2 hrs, 36 mins) · Intermediate

Watch our video course Networking with URLSession to learn how to use Apple's networking API. Learn when and how to use data, download and upload tasks, with or without a custom session delegate, and how the system manages background sessions. Keep your users' data safe with authentication and App Transport Security, and pick up tips for networking architecture, testing and metrics.

Version

  • Swift 3, iOS 10, Xcode 8

Introduction

6:16 Free

Find out what’s covered in our video course Networking with URLSession.

1

HTTP 101

9:58

Learn some HTTP basics to make the most of URLSession, and discover the easy way to create URL objects from Strings.

2

URLSession

8:53

The URLSession API has many moving parts: learn about URLSessionConfigurations, URLSessionTasks and delegates, and how they fit together.

3

Learn about REST and JSON, then create a URLSession data task that makes a GET request on a REST API, and parses the JSON URLResponse.

4

Learn about URLRequest and HTTP headers, then create a URLSessionDataTask to POST to a REST API. Also build an Alamofire-inspired PostRouter to create URLRequests.

5

Learn about URLSessionDownloadTask and URLSessionUploadTask to save results to a file, or upload a data object or a file.

6

Download and upload tasks can run in a background session. Find out how the system handles this, and learn some advice and tips for long-running tasks.

7

Learn how to handle authentication and cookies.

8

ATS

19:59 Free

Learn what your app needs to do, to support Apple's requirement for App Transport Security.

9

URLSession is an OperationQueue, and delegate and completion methods run on another OperationQueue: learn how to customize the delegate queue.

10

Architecture

11:42

MVC shouldn't mean Massive View Controller: learn some ways to move networking code out of the view controller, and how to wrap a session task in an Operation.

11

Writing unit tests is A Good Thing: learn how to test asynchronous network code. Also, find out how to access URLSessionTaskMetrics transaction data.

12

Conclusion

3:58

Review what you've learned in this video course, and get a TODO list for discussions with your back-end server team.

13

Contributors

Comments