Open turabhassan89 opened 7 years ago
This is the correct behaviors. The first and third will execute first since they are on the same thread. The second will only fire once the network call is done.
So what I am trying to do here is to download the data and after downloading parse it and save it and then do a lookup. I am able to download it and parse correctly but the lookup function tries for a lookup before the data is parsed. Does this mean that I need a completion handler within a completion handler? One for downloading the data(which I have right now) and one for parsing the data. How will I go about writing that?
sharedNetworking.sharedInstance.downloadDataBusiness() { (fromDownload) in
print("ready to parse")
self.parseData (dataDownloaded: fromDownload)
}
doALookup()
I have a simple view controller and after downloading the data I need to update the view controller based on the data that was downloaded but I have been able to figure out how to do a tableview.reloaddata() equivalent in a simple view controller.
I have code setup like this:
But the first and third print statement always print first. I have also tried to put the code on the main thread and also in viewwillAppear function but it is not working. I have pushed my code for this as well.