Beginning Async/Await in iOS 15 and Swift 5.5

Mohammad Azam
6 min readJun 15, 2021

Asynchronous programming is a common requirement of any iOS application. The ability to perform task on a separate thread and not disturbing or blocking the user interface is always considered a good practice. In iOS 15 and Swift 5.5 Apple introduced async/await feature, which allows developers to easily implement asynchronous tasks with increased clarity and less lines of code.

In this article, we are going to take a look at how you can use async/await, continuation and actors in your iOS application.

Asynchronous Programming Using Callbacks

Before we jump into the new async/await features, we need to see how things are handled currently. It is by looking at the the past, we can appreciate the future.

For this example we are going to use JSONPlacefolder API to fetch all posts. The implementation of our client is shown below:

We all have implemented similar code in our application. The main issue with the above code is that you need to remember to return from the guard clauses…

--

--

Mohammad Azam

Lead instructor at a coding bootcamp. Top iOS mobile instructor on Udemy. Author of multiple books and international speaker. azamsharp.school