dmytro-anokhin / url-image

AsyncImage before iOS 15. Lightweight, pure SwiftUI Image view, that displays an image downloaded from URL, with auxiliary views and local cache.
MIT License
1.1k stars 96 forks source link

[Bug]Images get cached without caching enabled #151

Closed ClmnsRck closed 3 years ago

ClmnsRck commented 3 years ago

My images for my server were cached and didn't refresh. How can i tell the framework to always reload? It even cached the images between reboots of the iPhone ...

dmytro-anokhin commented 3 years ago

Hey,

I assume you're using v3 of the package. The answer depends on how you configure the cache.

If you did not configure the store, URLImage will use protocol cache policy. It should respect your cache header. You can change this using URLImageOptions: .environment(\.urlImageOptions, URLImageOptions(urlRequestConfiguration: .init(cachePolicy: .reloadIgnoringCacheData))). This is basically URLRequest.CachePolicy setting.

If you did configure the store that comes with the package, you can delete all or individual images. Look up in URLImageFileStore and URLImageInMemoryStore headers. It lacks documentation, but method names are self explanatory.

Hope this helps. If you think there is a bug, please open a new issue and fill in the bug report template. Thank you.