Converting closure-based code into async/await in Swift

Existing Swift APIs often provide asynchronous code execution using callback closures or delegate methods, which allow the caller to define what happens when the asynchronous task has finished. Swift's new concurrency model enables us to create similar asynchronous APIs using async/await and also provides methods for interfacing async/await with existing callback-based or delegate-based asynchronous APIs. In this post from his Modern Concurrency in Swift series, Andy Ibanez explains what continuations are and shows us how to use them to bridge from closure-based or delegate-based APIs to async/await.