Modern Concurrency: Getting Started

Learn how to use Swift’s new native model for writing safe, efficient concurrent code. Create safe, performant and predictable asynchronous apps using these Swift concurrency features: async/await Tasks MainActor Asynchronous sequences By Audrey Tam.

3.6 (7) · 5 Reviews

Download materials
Save for later
Comments
Share

Learning path

This is part of the Concurrency in iOS learning path. View path.

Who is this for?

This course is for intermediate Swift developers who are familiar with writing asynchronous applications, but want to leverage the new concurrency features in Swift 5.5 to write safer and more predictable asynchronous apps.

Covered concepts

  • Using async/await
  • Tasks
  • MainActor
  • Asynchronous Sequences

Part 1: Asynchronous Code

01
Toggle description

What is Swift concurrency? Why is it better than GCD? What about Combine? In this course, you’ll learn how to create safe, performant and predictable asynchronous apps using these Swift concurrency features: async/await, Tasks, asynchronous sequences and MainActor.

Toggle description

Explore Task and async/await in a playground.

Toggle description

Learn how to set up the course server, then use async/await and the task view modifier in the LittleJohn app’s SymbolListView.

Toggle description

Learn how to define async properties and subscripts and how to iterate over built-in and custom async sequences.

Toggle description

Use AsyncSequence in the LittleJohn app’s TickerView.

Toggle description

Learn how to handle the server becoming unavailable during a price update.

Conclusion 1:22
Toggle description

Review what you learned in Part 1 and see what’s coming up in Part 2.

Part 2: Asynchronous Sequences

Toggle description

Learn about the app you’ll build in this part of the course and the Swift concurrency tools you’ll use.

Toggle description

Challenge: Reinforce what you learned in Part 1 by implementing the list view in the SuperStorage app. Try not to peek at LittleJohn’s SymbolListView.

Toggle description

Use async let to download server status concurrently with the files list.

Toggle description

In a Button action, call an asynchronous method that updates view properties. Use Task to call the asynchronous method and move the model’s helper methods to MainActor.

Toggle description

Challenge: Show/hide a progress view spinner.

Toggle description

Display a progress view while downloading a file in chunks.

Toggle description

Implement your own custom logic to cancel download tasks that you don’t need anymore.

Toggle description

Create an AsyncSequence from the Combine publisher of Timer.

Toggle description

Challenge: Download the file chunks in parallel.

Conclusion 2:19
Toggle description

Review what you learned in this course and see what’s covered in Modern Concurrency: Beyond the Basics.

Up next

iOS & Swift
Modern Concurrency: Beyond the Basics
Build on your knowledge of async/await, tasks and asynchronous sequences to use concurrent tasks in safe, performant and predictable asynchronous apps. Learn how to create and use custom AsyncStream sequences, continuations, task groups and custom actors.

Instructors

Contributors

Audrey Tam

Instructor

Adrian Strahan

Tech Editor

Adriana Kutenko

Illustrator

Abigail Seperidad

Video Editor

Over 300 content creators. Join our team.