I need to call func fillFields after that func getJsonData is over.
The func getJsonData is a Async Task for get data on server for URLRequest.
func getAPIData() {
let initial = URL(string: "http://10.0.0.2/Blower/app/api/inicial.php")
DispatchQueue.main.async {
_ = URLSession.shared.dataTask(with: initial!) { (dados, requisicao, erro) in
if requisicao != nil {}
if let dados = dados {
do {
let json = try JSONSerialization.jsonObject(with: dados, options: []) as! [String: Any]
/*
*
*/
} catch {
print(erro as Any)
}
}
}.resume()
}
}
How can I know if the function getAPIData is finished?