How to Use PromiseKit in iOS Development with Swift

Yusuf Demirci
3 min readMay 8, 2020

Problem

Calling multiple functions in a sequence is complicated.

Solution

We have to build a chain in which its items communicate asynchronously. We can able to add new items to any position of the chain. PromiseKit is a tool which helps us to build the chain, in a structure.

Have you ever called more than one function at the launching of an application? Of course, you have called. Probably, you have checked camera permission and location permission at the same time. What about other checks such as if the user logged in, sending the request for the first data, etc. I am going to use PromiseKit to clean this mess.

What are we going to do?

We are going to build a simple one-screen project. As soon as the first screen launches, we will check if the user did log in, camera and location permission. After the permissions, we will send two requests parallelly. When the chain completed, we will give data to the view. If any error occurred before complete the chain, the chain will interrupt and we will show an alert. I have finished a working…

--

--