I have tested it with the .setImage function and with the code below and in both cases the completion block is never called.
Fetching is printed as expected but I never get to got it. In the case of the .setImage the imageView's image is being set but the completion block is never called there either.
if let photo = project?.photos[indexPath.row],
let photoURL = URL(string: "\(project?.smallResBaseURL ?? "")\(photo.filename)") {
print("FETCHING")
let fetcher = ImageFetcher(downloader: Option().downloaderMaker(), storage: Imaginary.Configuration.imageStorage)
fetcher.fetch(url: photoURL, completion: { (result) in
print("** GOT IT **")
switch result {
case .value(let image):
if photo.ratio == 0 {
let ratio = Double(image.size.height / image.size.width)
photo.updateRatio(ratio)
collectionView.collectionViewLayout.invalidateLayout()
}
case .error(let error):
print(error.localizedDescription)
}
})
I have tested it with the .setImage function and with the code below and in both cases the completion block is never called.
Fetching is printed as expected but I never get to got it. In the case of the .setImage the imageView's image is being set but the completion block is never called there either.