What role do Tasks play within Swift’s concurrency system?
When writing asynchronous code using Swift’s new built-in concurrency system, creating a
Task
gives us access to a new asynchronous context, in which we’re free to callasync
-marked APIs, and to perform work in the background.But besides enabling us to encapsulate a piece of asynchronous code, the
Task
type also lets us control the way that such code is run, managed, and potentially cancelled.
Source: What role do Tasks play within Swift’s concurrency system?, an article by John Sundell.