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

Config AFImageDownloader NSURLCache and ask AFImageRequestCache implementer if an image should be cached #4010

Merged
merged 9 commits into from Dec 15, 2017
Next

Ability to set the defaultURLCache

  • Loading branch information...
wjehenddher committed Jul 26, 2017
commit 41897b19c6fb8b95944909f414a57323371508a3
@@ -81,6 +81,11 @@ typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) {
*/
+ (NSURLCache *)defaultURLCache;
/**
Sets the default `NSURLCache`
*/
+ (void) setDefaultURLCache:(NSURLCache *)defaultCache;
/**
Default initializer
@@ -106,10 +106,16 @@ @interface AFImageDownloader ()
@end
static NSURLCache* _defaultURLCache = nil;
@implementation AFImageDownloader
+ (NSURLCache *)defaultURLCache {
if (_defaultURLCache) {
return _defaultURLCache;
}
// It's been discovered that a crash will occur on certain versions
// of iOS if you customize the cache.
//
@@ -125,6 +131,11 @@ + (NSURLCache *)defaultURLCache {
diskPath:@"com.alamofire.imagedownloader"];
}
+ (void)setDefaultURLCache:(NSURLCache *)defaultCache {
_defaultURLCache = defaultCache;
}
+ (NSURLSessionConfiguration *)defaultURLSessionConfiguration {
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
ProTip! Use n and p to navigate between commits in a pull request.