Angel Morales
1 min readMar 29, 2018

--

Awesome tutorial Malcom! I appreciate that you cover several topics with your tutorial, thank you 👏🏼👏🏼👏🏼

I followed your guide, and I notice that the response from the service is received on another thread. So I have a couple of questions regarding to this:

  1. Most of the cases we are looking to update the UI once we got the service response, would you recommend using GCD like DispatchQueue.main.async in the Router class, in the request function just before the completion callback? Or dispatch back to the main queue at the ViewController layer?
  2. How would you deal with “chaining” service calls? For example, lets say we need to call endpoint A, and then…with that response call endpoint B. When receiving response from endpoint A, do we have to dispatch back to the main queue before calling Endpoint B? Or can we call endPoint A and endpoint B on different threads and at the end, with the overall response, calling back to the main queue?

--

--

Angel Morales
Angel Morales

Written by Angel Morales

 iOS Developer📱 México 🇲🇽 technology 💻 apps, music 🎶, photos 📷 and movies 🎥. Check out my YouTube channel -> https://tinyurl.com/urrdm5z

Responses (1)