I am writing simple REST API client. On each UITableViewCell selection the GET request is performed. As the request is performed in another thread, the view loads faster than it receives the response. So, the empty screen is shown at every segue for a second. I want the segue to be performed only after the data is loaded from the server.
I've tried to move the request code from the viewDidLoad to the prepare(forSegue) method. But the request is async, so it doesn't change anything... I've tried to synchronize the execution of the request, but this will block the UI, so I have no idea how to do that.