Tarvo Mäesepp Tarvo Mäesepp - 2 months ago 32x
Swift Question

Images not caching with Firebase url but caching with other

I have little problem. I got caching to work with the following


let URL = NSURL(string: "https://raw.githubusercontent.com/onevcat/Kingfisher/master/images/kingfisher-\(indexPath.row + 1).jpg")!

But can't get it to work like this with this

FIRStorage.storage().reference().child("\(productImageref!).png").downloadURLWithCompletion({(url, error)in

if error != nil{

cell.snusProductImageView.kf_setImageWithURL(url , placeholderImage: nil,
optionsInfo: [.Transition(ImageTransition.Fade(1))],
progressBlock: { receivedSize, totalSize in
print("\(indexPath.row + 1): \(receivedSize)/\(totalSize)")
completionHandler: { image, error, cacheType, imageURL in
print("\(indexPath.row + 1): Finished")


What I am doing wrong here? Can you point me to the right direction? For caching I use the 3rd party library "KingFisher"

Edit: Firebase guy Mike McDonald's quote

"The Github one has Cache-Control: max-age=300 while Firebase Storage
doesn't have cache control set by default (you can set it when you
upload the file, or change it by updating metadata), so I assume
that's why KingFisher isn't caching it."

KingFisher owner quotes.


The way I got them caching was that I had to write all image url-s into JSON like this:


And then read those as url-s