Browse Source

Merge pull request #2107 from limeade/publicImageLoadingResultInit

Added a public init to ImageDownloadResult
Wei Wang 2 years ago
parent
commit
40d7062bd9
1 changed files with 11 additions and 0 deletions
  1. 11 0
      Sources/Networking/ImageDownloader.swift

+ 11 - 0
Sources/Networking/ImageDownloader.swift

@@ -43,6 +43,17 @@ public struct ImageLoadingResult {
 
     /// The raw data received from downloader.
     public let originalData: Data
+
+    /// Creates an `ImageDownloadResult`
+    ///
+    /// - parameter image: Image of the download result
+    /// - parameter url: URL from where the image was downloaded from
+    /// - parameter originalData: The image's binary data
+    public init(image: KFCrossPlatformImage, url: URL? = nil, originalData: Data) {
+        self.image = image
+        self.url = url
+        self.originalData = originalData
+    }
 }
 
 /// Represents a task of an image downloading process.