So I'm parsing a json response from an API service and I update the UI in the response parse closure which is supposed to happen asynchronously.
I noticed that - even though the API's response is very fast as I can tell from the console log - the UI doesn't update instantly. It takes a few seconds to update.
So I searched a bit and I found out that putting my UI update code inside DispatchQueue.main.async() fixes it.
Why is that the case? Aren't closures supposed to be async and take care of all that? Am I misunderstanding something? Thanks