The Power of Tasks in Swift: Concurrency Made Easy

Take it to the task!

Steven Curtis
11 min readMay 3, 2023
Photo by Kelly Sikkema on Unsplash

Tasks are part of Swift’s new concurrency model introduced way back in 2021. Essentially a Task allows us to create a concurrent environment from a non-concurrent method. That is we can call async APIs in order to perform work in the background giving us a safe way to manage concurrency.

Let’s look at the detail.

Before we start

Difficulty: Beginner | Easy | Normal | Challenging

This article has been developed using Xcode 14.2, and Swift 5.7.2

Prerequisites:

Keywords and Terminology:

Task: A task represents a unit of work that can be executed asynchronously, independently of the main thread of the application.

What are Tasks in Swift?

Tasks are a unit of work that can be executed asynchronously, independently on the main thread of the application. That is, you can provide a closure that contains the work for the task to perform.

--

--