Requires a pro subscription Pro

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.

Login to leave a rating/review
Download materials
Save for later
Share

Who is this for?

This book 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

1
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.

2
Toggle description

Explore Task and async/await in a playground.

3
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.