How can I convert my current Alamofire request into a synchronous request? Will this stop all other execution until the request completes?
MY current function is as follows:
func updateLabels() {
Alamofire.request(apiUrl).responseJSON { response in
if let data = response.result.value {
var rawJson = JSON(data)
var json = rawJson[0]
var totalViews = json["totalViews"].stringValue
var uniqueUsers = json["uniqueUsers"].stringValue
print(totalViews)
print(uniqueUsers)
self.totalViews.setText(totalViews)
self.uniqueUsers.setText(uniqueUsers)
}
}
}
I'm using Alamofire_Synchronous
. I'm not super familiar with Alamofire so any help would be awesome, thanks!