How do make a synchronous call in swift?
- Do not use swift promises library
- Do not use Alamofire library
Here’s what I want to do:
I want to fetch data from api synchronously so that the tableview renders only when I have the complete data. If the call is asynchronous, multiple tableview reloads have to happen and that’s bad. I tried doing a semaphore with dispatch queue but it didn’t work. Any help is greatly appreciated.
I don't know anything about swift but making a synchronous api call doesn't seem to be a good idea
Do not make a synchronous call. It is possible, but it is hard to do for a reason. You can wait until you have collected all the data asynchronously and then call tableView.reloadData() to reload all the data.
If you need more information write me on telegram @bruce_tl with your project and what exactly you are trying to do and I would be happy to help you.
Please sign in to leave a comment.