I have a table view with two sections
These two sections contains data from two different urls
Im using Alamofire to download content from json.
Url from section 1 has more content than section 2. Both tasks are runnings asynchronously
Once section 2 data has been completed, im reloading table view. But for some reason my section1 data gets terminatted and no results are displayed
Please let me know how to handle that. Below is the sample code structure
let url1 = "https://xxxxxxxxxx.com"
Alamofire.request(url1)
.responseJSON { response in
guard let json = response.result.value as? [Any] else {}
//do parsing from json
mytableview.reloadData()
}
let url2 = "https://yyyyyyyyy.com"
Alamofire.request(url2)
.responseJSON { response in
guard let json = response.result.value as? [Any] else {}
//do parsing from json
mytableview.reloadData()
}
In my case, data from url2 is fetching and parsing json fast and is reloadingtableview. While doing my url1 is still parsing data
How can I display both url1, url2 data at a time after all the parsing done. Please advice