Skip to content

Commit

Permalink
Merge pull request onevcat#696 from onevcat/fix/manager-default-options
Browse files Browse the repository at this point in the history
Consider manager default options
  • Loading branch information
onevcat authored Jun 2, 2017
2 parents 2e985b8 + e6a661d commit bd5f0f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/KingfisherManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public class KingfisherManager {
/// - Note: This option will not be applied to independent using of `ImageDownloader` or `ImageCache`.
public var defaultOptions = KingfisherEmptyOptionsInfo

var currentDefaultOptions: KingfisherOptionsInfo {
return [.downloader(downloader), .targetCache(cache)] + defaultOptions
}

convenience init() {
self.init(downloader: .default, cache: .default)
}
Expand Down Expand Up @@ -117,7 +121,7 @@ public class KingfisherManager {
completionHandler: CompletionHandler?) -> RetrieveImageTask
{
let task = RetrieveImageTask()
let options = defaultOptions + (options ?? KingfisherEmptyOptionsInfo)
let options = currentDefaultOptions + (options ?? KingfisherEmptyOptionsInfo)
if options.forceRefresh {
_ = downloadAndCacheImage(
with: resource.downloadURL,
Expand Down

0 comments on commit bd5f0f9

Please sign in to comment.