Просмотр исходного кода

Added a public init to ImageDownloadResult

Kai Maschke 2 лет назад
Родитель
Сommit
fb08982521
1 измененных файлов с 11 добавлено и 0 удалено
  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.
     /// The raw data received from downloader.
     public let originalData: Data
     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.
 /// Represents a task of an image downloading process.