Thank you Jonathan!

I am glad you read the post, I am probably wrong but I think that I am already reloading the tableview on the main Thread. By definition closures are executed on background thread, thats why we need to use DispatchQueue.main.Async {} when we call the closure to pull the response to the main thread, when you do that like I did in the implementation on MovieService, what gets triggered for that call on main thread is also handled by the main thread, I invite you to check it out and put a breakpoint in the property observer where I am reloading the tableview and go to the thread inspector and see that the reloading is been executed on main thread. I can be wrong of course but thats my understanding about closures and threads, what do you think?

Written by

Senior iOS Engineer #latinintech

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store