pinterest / PINRemoteImage

A thread safe, performant, feature rich image fetcher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Option to Prefer Cache Image (if exists) over Placeholder

Sonictherocketman opened this issue · comments

Apologies if this already exists, but I couldn't find a reference anywhere in the docs, and I'm unclear as to the order of ops when it comes to loading cached items vs. the placeholder images. As far as I'm aware, calling the following:

        imageView.pin_setImage(
            from: site.image,
            placeholderImage: UIImage(named: "Custom Placeholder")
        )

will cause the library to load the placeholder image and attempt to make a network call. If the call succeeds it will use that item, otherwise it falls back to the cache.

Is there any way to configure the PINRemoteImageManager or the PINCache to always check the cache first and load any image found there before going to the network? This would greatly reduce the number of times that my placeholder image is shown.

I can reach into the cache myself, but I figure I'd check if its natively supported before doing so.

@Sonictherocketman It does check the cache before hitting the network, but you're right, it doesn't check it before setting the placeholder image.