forked from shadowfacts/Tusker
Fix ImageCache.get completion not being called when image isn't loaded
This commit is contained in:
parent
59d866aa23
commit
abb8352c92
|
@ -37,15 +37,19 @@ class ImageCache {
|
||||||
let wrappedCompletion: ((Data?, UIImage?) -> Void)?
|
let wrappedCompletion: ((Data?, UIImage?) -> Void)?
|
||||||
if let completion = completion {
|
if let completion = completion {
|
||||||
wrappedCompletion = { (data, image) in
|
wrappedCompletion = { (data, image) in
|
||||||
|
if let image {
|
||||||
if !loadOriginal,
|
if !loadOriginal,
|
||||||
let size = self.desiredPixelSize {
|
let size = self.desiredPixelSize {
|
||||||
image?.prepareThumbnail(of: size, completionHandler: {
|
image.prepareThumbnail(of: size) {
|
||||||
completion(data, $0)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
image?.prepareForDisplay {
|
|
||||||
completion(data, $0)
|
completion(data, $0)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
image.prepareForDisplay {
|
||||||
|
completion(data, $0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
completion(data, image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue