What is async/await
Asked on 06/16/2025
2 searches
Async/await is a feature in Swift that allows you to write asynchronous code in a more readable and maintainable way. It is part of Swift's concurrency model, which helps improve the responsiveness of applications by allowing certain operations to be performed without blocking the main thread.
Here's how it works:
-
Async Functions: A function that can be suspended and resumed later is marked with the
async
keyword. This indicates that the function contains operations that might take some time to complete, such as network requests or file I/O. -
Await Keyword: When calling an async function, you use the
await
keyword. This marks a potential suspension point in your code, where the function might pause its execution to wait for the async operation to complete. During this suspension, other tasks can run, keeping the UI responsive. -
Concurrency: By using async/await, you can break up your functions into parts that can run independently, allowing other work to be done while waiting for long-running operations to complete. This is particularly useful for tasks like fetching data over the network, where you don't want to block the main thread and cause the UI to freeze.
For more detailed information, you can refer to the session Embracing Swift concurrency (06:00) and Code-along: Elevate an app with Swift concurrency (03:42) from WWDC 2025.

Code-along: Elevate an app with Swift concurrency
Learn how to optimize your app’s user experience with Swift concurrency as we update an existing sample app. We’ll start with a main-actor app, then gradually introduce asynchronous code as we need to. We’ll use tasks to optimize code running on the main actor, and discover how to parallelize code by offloading work to the background. We’ll explore what data-race safety provides, and work through interpreting and fixing data-race safety errors. Finally, we’ll show how you can make the most out of structured concurrency in the context of an app.

Embracing Swift concurrency
Join us to learn the core Swift concurrency concepts. Concurrency helps you improve app responsiveness and performance, and Swift is designed to make asynchronous and concurrent code easier to write correctly. We’ll cover the steps you need to take an app through from single-threaded to concurrent. We’ll also help you determine how and when to make the best use of Swift concurrency features – whether it’s making your code more asynchronous, moving it to the background, or sharing data across concurrent tasks.

Go further with Swift Testing
Learn how to write a sweet set of (test) suites using Swift Testing’s baked-in features. Discover how to take the building blocks further and use them to help expand tests to cover more scenarios, organize your tests across different suites, and optimize your tests to run in parallel.