I need to take the value of my request to set the value of the rows
func getProjects(_ role:Int, _ idUser:Int, done:@escaping (_ response:JSON)-> Void){
let parameters:Parameters = ["role":role,"idUser":idUser]
Alamofire.request("http://localhost:8000/value",method:.post,parameters:parameters).responseJSON{
response in
let json = JSON(response.value)
done(json)
}
}
I take the value of the json to set it in the function and try with viewWillAppear but because it is asynchronous you can not
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return json.count
}