title: Run code only after asynchronous function finishes executing
body: <p>I am relatively new to Swift and Xcode in general and am finding a lot of difficulty trying to figure this out.</p>
  
  <p>I am developing an app that utilizes the <code>Parse.com</code> backend server. In order not to block the main thread, whenever the app downloads anything from the server, it is done on a different thread, asynchronously. However the rest of the code continues to execute on the main thread, and it crashes when the data it is supposed to have from the server has not downloaded yet. I would like to know how to call functions to run after the asynchronous function finishes, and this has to be done for functions in separate files. </p>
  
  <p>I read that closures might help with this, but I found there syntax very difficult and an explanation would be greatly appreciated. But any way would be very helpful.</p>
  
  <p>Thanks </p>