Here’s an open source library built for a similar purpose for Swift adding a number of nice features called TaskQueue from Marin Todorov.
TaskQueue not only provides a nice clean way to manage your asynchronous code in Swift, but also also adds flow control features such as adding tasks to the queue, skipping of tasks and retrying tasks.
view source