Kingfisher

How to set image using Kingfisher when image url did not change but image changed

我怕爱的太早我们不能终老 提交于 2019-12-23 11:54:40
问题 How to retrieve correct image using Kingfisher when image url did not change but image changed such as Twitter or GitHub. SDWebImage has a option [SDWebImageRefreshCached] to solve the problem. /** * Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed. * The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation. * This option helps deal with images changing behind the

How to load image asynchronously with Swift using UIImageViewExtension and preventing duplicate images or wrong Images loaded to cells

孤街醉人 提交于 2019-12-21 23:14:46
问题 Im developing an image loading library in Swift 4 something like Kingfisher with some extensions to support loading images from URL into an UIImageView . So then i can use this extension on a UICollection or UITableview cell with an UIImageView like this : let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectioncell", for: indexPath) if let normal = cell as? CollectionViewCell { normal.imagview.loadImage(fromURL:imageURLstrings[indexPath.row]) } Basically this is my

Kingfisher with Firebase storage slow to display images - swift 3

混江龙づ霸主 提交于 2019-12-12 02:36:22
问题 Im saving images from a picker up to firebase. Then I'm bringing them back down to my Tableview, but they update really slowly from kingfisher. even from the cache. If I reload the app offline, they still take time to appear Saving up to Firebase Storage func Save(image:UIImage, folderName:String, storeRefString:String, dbRefString:String) { let ref = FIRDatabase.database().reference(withPath: "Main") let database = FIRDatabase.database() let storage = FIRStorage.storage() let mainScreenItem

IOS Rxswift use Kingfisher to prefetch cell Image

五迷三道 提交于 2019-12-08 07:37:53
问题 I'm trying to implement Kingfisher prefetch feature inside an Rxswift project. The problem is with these 2 function collectionView.rx.prefetchItems collectionView.rx.cancelPrefetchingForItems The instruction at Kingfisher github is quite short override func viewDidLoad() { super.viewDidLoad() collectionView?.prefetchDataSource = self } extension ViewController: UICollectionViewDataSourcePrefetching { func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths:

IOS Rxswift use Kingfisher to prefetch cell Image

99封情书 提交于 2019-12-08 07:26:33
I'm trying to implement Kingfisher prefetch feature inside an Rxswift project. The problem is with these 2 function collectionView.rx.prefetchItems collectionView.rx.cancelPrefetchingForItems The instruction at Kingfisher github is quite short override func viewDidLoad() { super.viewDidLoad() collectionView?.prefetchDataSource = self } extension ViewController: UICollectionViewDataSourcePrefetching { func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) { let urls = indexPaths.flatMap { URL(string: $0.urlString) } ImagePrefetcher(urls: urls).start() }

Insert Authorization Header field with kingfisher lib

送分小仙女□ 提交于 2019-12-06 23:59:45
问题 I'm using Kingfisher to show image from url, but my endpoint requires a Authorization header. How to use these kind of url with Kingfisher or SDWebImage in iOS? 回答1: With Kingfisher you need to make a request modifier (of type AnyModifier ) and pass it as a parameter in the options part of the .kf.setImage method, and then use the trailing closure to actually set the image. Example: import Kingfisher let modifier = AnyModifier { request in var r = request // replace "Access-Token" with the

How to cache images only in disk using Kingfisher?

回眸只為那壹抹淺笑 提交于 2019-12-06 22:38:07
问题 I am using Kingfisher library for downloading and caching images. I am facing some issues in the implementation: Are the images cached in both memory and disk? Is there any provision to cache images only on disk? I have already read multiple posts regarding this, but couldn't find any solution. 回答1: Yes, Kingfisher caches images both in memory and on disk. By default, the amount of RAM that will be used is not even limited, you have to set the value yourself: ImageCache.default.maxMemoryCost

How to cache images only in disk using Kingfisher?

前提是你 提交于 2019-12-05 03:24:55
I am using Kingfisher library for downloading and caching images. I am facing some issues in the implementation: Are the images cached in both memory and disk? Is there any provision to cache images only on disk? I have already read multiple posts regarding this, but couldn't find any solution. Yes, Kingfisher caches images both in memory and on disk. By default, the amount of RAM that will be used is not even limited, you have to set the value yourself: ImageCache.default.maxMemoryCost = 1024 * 1024 * yourValue where 1024 * 1024 * yourValue is the global cost in megapixels (I know this is

How to load image asynchronously with Swift using UIImageViewExtension and preventing duplicate images or wrong Images loaded to cells

☆樱花仙子☆ 提交于 2019-12-04 19:55:38
Im developing an image loading library in Swift 4 something like Kingfisher with some extensions to support loading images from URL into an UIImageView . So then i can use this extension on a UICollection or UITableview cell with an UIImageView like this : let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectioncell", for: indexPath) if let normal = cell as? CollectionViewCell { normal.imagview.loadImage(fromURL:imageURLstrings[indexPath.row]) } Basically this is my extension Code , implementing the basic URLSession dataTask and Caching public extension UIImageView {

Kingfisher and swift 3 - cannot set image with url

隐身守侯 提交于 2019-12-04 17:21:24
Checking the documentation and the migration guide, I should be able to set a new image using this code: imageView.kf.setImage(with:url ...) but actually I cannot find this method in the library, I only see: imageView.kf.setImage(with:Resource... ) I don't know exactly how this resource shoud work though since I cannot find anything in the documentation. Resource is a protocol. URL has been extended to conform to this protocol. So you can do: let url = URL(string: ...)! imageView.kf.setImage(with: url) If you want some control over what Kingfisher uses for the key in its cache, you can use