I use Alamofire and AlamofireImage in my app for get data and photos.
Alamofire.request(.GET, URLString, encoding: .JSON)
.authenticate(user: use
Updated for swift:
Used below simple function;
func clearImageFromCache(mYourImageURL: String) {
let URL = NSURL(string: mYourImageURL)!
let mURLRequest = NSURLRequest(url: URL as URL)
let urlRequest = URLRequest(url: URL as URL, cachePolicy: URLRequest.CachePolicy.reloadIgnoringLocalAndRemoteCacheData)
let imageDownloader = UIImageView.af_sharedImageDownloader
_ = imageDownloader.imageCache?.removeImage(for: mURLRequest as URLRequest, withIdentifier: nil)
self.mImageView.af_setImage(withURLRequest: urlRequest, placeholderImage: UIImage(named: "placeholder"), completion: { (response) in
self.mImageView.image = response.result.value
})
}
// NOTE:- where placeholder = your_placeholder_image_name