swift SDWebImage使用

1.SDWebImage下载图片

swift中,下载玩图片后,不会将图片缓存到沙盒,需要手动调用SDImageCache.shared.store保存到沙盒

 SDWebImageDownloader.shared.downloadImage(with: url, options: SDWebImageDownloaderOptions.highPriority, context: nil, progress: nil) { (image, data, _, _) in
      SDImageCache.shared.store(image, forKey: url.absoluteString, completion: {
                        
             print("图片保存成功")
             print(image as Any)
             print(data as Any)
       })   
 }

你可能感兴趣的:(swift SDWebImage使用)