var listModel = [ListModel]() {
didSet {
DispatchQueue.main.async { [weak self] in
guard let self = self else {
return
}
self.resultClosure?(self.listModel[0])
}
var resultClosure: ((ListModel) -> Void)?
func GetStringUrlService(url:String, uiImage: UIImage, completion: @escaping (Result<[ListModel]>) -> Void) {
if !url.isEmpty {
print("\n Services GetStringUrlService2 !url.isEmpty \n")
let result = [ListModel.init(imageUrl: url, uiImage: uiImage)]
self.listModel = result
completion(.success(result))
print("\n Services GetStringUrlService result - \(result) \n")
} else {
print("\n Services GetStringUrlService failure \n")
}
}
}
}
homeView.GetStringUrlService(url: graphImageHD, uiImage: image) { (result: Result<[ListModel]>) in
switch result {
case .success (let listModel):
homeView.listModel = listModel
print("\n GetManager GetStringUrlService listModel homeView - \(listModel) \n")
print("\n GetManager GetStringUrlService homeView listModel homeView - \(homeView.listModel) \n")
return
case .failure(let error):
print("\n GetManager fetchData failure \(error.localizedDescription) \n")
return
}
}