SDWebImage Download image and store to cache for key

后端 未结 11 1515
失恋的感觉
失恋的感觉 2020-12-24 03:30

Hello I am using the SDWebImage framework in a project and I want to download and cache images, but I think my code is storing an image in the cache twice? Is there any way

11条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-24 03:52

    Try this for Swift 4.0.

    let url = URL(string: imageUrl!)
    
    SDWebImageManager.shared().imageDownloader?.downloadImage(with: url, options: .continueInBackground, progress: nil, completed: {(image:UIImage?, data:Data?, error:Error?, finished:Bool) in
         if image != nil {. 
    
         }
    })
    

提交回复
热议问题