Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Sonictherocketman opened this issue Nov 6, 2019 · 1 comment
Open

Comments

@Sonictherocketman
Copy link

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.

@garrettmoon
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants