Chapter 11: SwiftUI Concurrency with async await

One of the most important features of Swift 5.5, released together with Xcode 13, is the introduction of the async and await keywords. With async and await, we can manage asynchronous concurrent code almost as if it was synchronous code.

Concurrency means that different pieces of code run at the same time. Often, we must orchestrate these pieces of code to create sequences of events to present the results in a view.

Before Swift 5.5, the most common way of creating a sequence of concurrent code was by using a completion block. When the first part of code finishes, we call a completion block where we start the second piece of code. This works and is manageable if we have only two asynchronous ...

Get SwiftUI Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.