iosswiftcachinguiimageviewhaneke

hanekeswift remove image from all FormatName


using Haneke Swift when I set an image to an UIImageView (scaled) with the .hnk_setImageFromUrl extension function, how can I remove this again from the Cache. I've tried:

profileImageView.hnk_setImageFromURL(NSURL(string: imageUrl)!)
Shared.imageCache.remove(key: imageUrl!)

checking the FileSystem and reading the code it's only removes images from HanekeGlobals.Cache.OriginalFormatName which still leads to cached images in the Auto*aspectfill caches

shared-images/auto-160.0x160.0-aspectfill:
-rw-r--r-- 1 user1 staff 123123 9 Jan 13:26 https%3A%2F%2Fapi.example.com%2Fpubapi%2Fusers%2Fuser%2Fpicture`

Is this expected behavior?

Ofcourse it's always an idea to clear the cache totally with

Shared.imageCache.removeAll()

Solution

  • The developers told me the following:

    You can do:

    Shared.imageCache.remove(key: imageUrl, formatName: profileImageView.hnk_format.name)
    

    Still, I think we probably should have a removeFromAll method.