forked from shadowfacts/Tusker
parent
94dc5d3177
commit
f7304a011c
|
@ -81,10 +81,7 @@ class ImageCache {
|
||||||
guard !ImageCache.disableCaching else { return }
|
guard !ImageCache.disableCaching else { return }
|
||||||
|
|
||||||
if !((try? cache.has(url.absoluteString)) ?? false) {
|
if !((try? cache.has(url.absoluteString)) ?? false) {
|
||||||
let task = dataTask(url: url) { data, image in
|
let task = dataTask(url: url, completion: nil)
|
||||||
guard let data else { return }
|
|
||||||
try? self.cache.set(url.absoluteString, data: data, image: image)
|
|
||||||
}
|
|
||||||
task.resume()
|
task.resume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +92,9 @@ class ImageCache {
|
||||||
let data else {
|
let data else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
completion?(data, UIImage(data: data))
|
let image = UIImage(data: data)
|
||||||
|
try? self.cache.set(url.absoluteString, data: data, image: image)
|
||||||
|
completion?(data, image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue