I have this code :
let task = URLSession.shared.dataTask(with: request) { (data: Data?, response: URLResponse?, error: Error?) in if error != nil {
I think, you use CallBack(Clourse) of Swift to return data when getDetail have data.