Browse Source

Merge pull request #521 from onevcat/fix/pure-swift-downloader

Make ImageDownloader non-objc
Wei Wang 9 years ago
parent
commit
2459ea72ad
2 changed files with 3 additions and 5 deletions
  1. 2 4
      Sources/ImageDownloader.swift
  2. 1 1
      Tests/KingfisherTests/ImageDownloaderTests.swift

+ 2 - 4
Sources/ImageDownloader.swift

@@ -166,7 +166,7 @@ extension AuthenticationChallengeResponsable {
 }
 
 /// `ImageDownloader` represents a downloading manager for requesting the image with a URL from server.
-open class ImageDownloader: NSObject {
+open class ImageDownloader {
     
     class ImageFetchLoad {
         var contents = [(callback: CallbackPair, options: KingfisherOptionsInfo)]()
@@ -234,9 +234,7 @@ open class ImageDownloader: NSObject {
         processQueue = DispatchQueue(label: "com.onevcat.Kingfisher.ImageDownloader.Process.\(name)", attributes: .concurrent)
         
         sessionHandler = ImageDownloaderSessionHandler()
-        
-        super.init()
-        
+
         // Provide a default implement for challenge responder.
         authenticationChallengeResponder = sessionHandler
         session = URLSession(configuration: sessionConfiguration, delegate: sessionHandler, delegateQueue: .main)

+ 1 - 1
Tests/KingfisherTests/ImageDownloaderTests.swift

@@ -248,7 +248,7 @@ class ImageDownloaderTests: XCTestCase {
         }
         
         XCTAssertNotNil(task, "The task should exist.")
-        XCTAssertEqual(task!.ownerDownloader, downloader, "The owner downloader should be correct")
+        XCTAssertTrue(task!.ownerDownloader === downloader, "The owner downloader should be correct")
         XCTAssertEqual(task!.url, URL(string: "1234"), "The request URL should equal.")
     }