Closed juanjovn closed 3 years ago
If someone is interested I solved the problem in this way: -Create an URLSessionConfiguration -Set requestCachePolicy to .reloadIgnoringLocalCacheData -Then set the gif from url to the image view passing a URLSession with the configuration previously created as a parameter. See the code below:
let configuration = URLSessionConfiguration.default
configuration.requestCachePolicy = .reloadIgnoringLocalCacheData
let manager = SwiftyGifManager.init(memoryLimit: 1)
var url = URL(string: "https://cataas.com/cat/gif")!
let loader = UIActivityIndicatorView(style: .white)
gifImageView.setGifFromURL(url, manager: manager, loopCount: -1, levelOfIntegrity: .default, session: .init(configuration: configuration), showLoader: true, customLoader: loader)
I'm using this library to get a random gif from and endpoint (https://cataas.com/cat/gif). My idea is to get a random gif every time the controller is showed. My problem is that the gif is stored in cache after the first time is loaded and the other times the same gif is showed. I checked that my View Controller is deallocating correctly after dismissing and I tried other issues solutions but none worked.