Skip to content

Commit

Permalink
Merge pull request SDWebImage#1321 from mythodeia/master
Browse files Browse the repository at this point in the history
Added a new constructor to SDWebImagePrefetcher
  • Loading branch information
mythodeia committed Sep 29, 2015
2 parents 3af1a30 + 944fd77 commit 2d748f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions SDWebImage/SDWebImagePrefetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls,
*/
+ (SDWebImagePrefetcher *)sharedImagePrefetcher;

/**
* Allows you to instantiate a prefetcher with any arbitrary image manager.
*/
- (id)initWithImageManager:(SDWebImageManager *)manager;

/**
* Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching,
* currently one image is downloaded at a time,
Expand Down
6 changes: 5 additions & 1 deletion SDWebImage/SDWebImagePrefetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ + (SDWebImagePrefetcher *)sharedImagePrefetcher {
}

- (id)init {
return [self initWithImageManager:[SDWebImageManager new]];
}

- (id)initWithImageManager:(SDWebImageManager *)manager {
if ((self = [super init])) {
_manager = [SDWebImageManager new];
_manager = manager;
_options = SDWebImageLowPriority;
_prefetcherQueue = dispatch_get_main_queue();
self.maxConcurrentDownloads = 3;
Expand Down

0 comments on commit 2d748f1

Please sign in to comment.