When writing asynchronous code using Swift’s new built-in concurrency system, creating a
Taskgives us access to a new asynchronous context, in which we’re free to call
async-marked APIs, and to perform work in the background.
But besides enabling us to encapsulate a piece of asynchronous code, the
Tasktype 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.