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

Merge pull request #4 from mrahmiao/master

Fix some typo
Wei Wang 10 лет назад
Родитель
Сommit
971b3e7d34

+ 1 - 1
Kingfisher-Demo/ViewController.swift

@@ -57,7 +57,7 @@ extension ViewController: UICollectionViewDataSource {
     
     override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
         let cell = collectionView.dequeueReusableCellWithReuseIdentifier("collectionViewCell", forIndexPath: indexPath) as! CollectionViewCell
-        cell.cellImageView.kf_setImageWithURL(NSURL(string: "https://raw.githubusercontent.com/onevcat/Kingfisher/master/images/kingfisher-\(indexPath.row + 1).jpg")!, placeHolderImage: nil, options: KingfisherOptions.LowPriority, progressBlock: { (receivedSize, totalSize) -> () in
+        cell.cellImageView.kf_setImageWithURL(NSURL(string: "https://raw.githubusercontent.com/onevcat/Kingfisher/master/images/kingfisher-\(indexPath.row + 1).jpg")!, placeholderImage: nil, options: KingfisherOptions.LowPriority, progressBlock: { (receivedSize, totalSize) -> () in
             println("\(indexPath.row + 1): \(receivedSize)/\(totalSize)")
         }) { (image, error, imageURL) -> () in
             println("\(indexPath.row + 1): Finished")

+ 4 - 4
Kingfisher/ImageDownloader.swift

@@ -21,7 +21,7 @@ public class ImageDownloader: NSObject {
     
     class ImageFetchLoad {
         var callbacks = [CallbackPair]()
-        var responsData = NSMutableData()
+        var responseData = NSMutableData()
         var shouldDecode = false
     }
     
@@ -148,9 +148,9 @@ extension ImageDownloader: NSURLSessionDataDelegate {
     public func URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, didReceiveData data: NSData) {
 
         if let URL = dataTask.originalRequest.URL, fetchLoad = fetchLoads[URL] {
-            fetchLoad.responsData.appendData(data)
+            fetchLoad.responseData.appendData(data)
             for callbackPair in fetchLoad.callbacks {
-                callbackPair.progressBlock?(receivedSize: Int64(fetchLoad.responsData.length), totalSize: dataTask.response!.expectedContentLength)
+                callbackPair.progressBlock?(receivedSize: Int64(fetchLoad.responseData.length), totalSize: dataTask.response!.expectedContentLength)
             }
         }
     }
@@ -175,7 +175,7 @@ extension ImageDownloader: NSURLSessionDataDelegate {
             dispatch_async(processQueue, { () -> Void in
                 
                 if let fetchLoad = self.fetchLoads[URL] {
-                    if let image = UIImage(data: fetchLoad.responsData) {
+                    if let image = UIImage(data: fetchLoad.responseData) {
                         if fetchLoad.shouldDecode {
                             self.callbackWithImage(image.kf_decodedImage(), error: nil, imageURL: URL)
                         } else {

+ 15 - 15
Kingfisher/UIImageView+Kingfisher.swift

@@ -42,62 +42,62 @@ public extension UIImageView {
     */
     public func kf_setImageWithURL(URL: NSURL) -> RetrieveImageTask
     {
-        return kf_setImageWithURL(URL, placeHolderImage: nil, options: KingfisherOptions.None, progressBlock: nil, completionHandler: nil)
+        return kf_setImageWithURL(URL, placeholderImage: nil, options: KingfisherOptions.None, progressBlock: nil, completionHandler: nil)
     }
     
     /**
     Set an image with a URL and a place holder image.
     
     :param: URL              The URL of image.
-    :param: placeHolderImage A placeholder image when retrieving the image at URL.
+    :param: placeholderImage A placeholder image when retrieving the image at URL.
     
     :returns: A task represents the retriving process.
     */
     public func kf_setImageWithURL(URL: NSURL,
-                      placeHolderImage: UIImage?) -> RetrieveImageTask
+                      placeholderImage: UIImage?) -> RetrieveImageTask
     {
-        return kf_setImageWithURL(URL, placeHolderImage: placeHolderImage, options: KingfisherOptions.None, progressBlock: nil, completionHandler: nil)
+        return kf_setImageWithURL(URL, placeholderImage: placeholderImage, options: KingfisherOptions.None, progressBlock: nil, completionHandler: nil)
     }
     
     /**
     Set an image with a URL, a place holder image and options.
     
     :param: URL              The URL of image.
-    :param: placeHolderImage A placeholder image when retrieving the image at URL.
+    :param: placeholderImage A placeholder image when retrieving the image at URL.
     :param: options          Options which could control some behaviors. See `KingfisherOptions` for more.
     
     :returns: A task represents the retriving process.
     */
     public func kf_setImageWithURL(URL: NSURL,
-                      placeHolderImage: UIImage?,
+                      placeholderImage: UIImage?,
                                options: KingfisherOptions) -> RetrieveImageTask
     {
-        return kf_setImageWithURL(URL, placeHolderImage: placeHolderImage, options: options, progressBlock: nil, completionHandler: nil)
+        return kf_setImageWithURL(URL, placeholderImage: placeholderImage, options: options, progressBlock: nil, completionHandler: nil)
     }
     
     /**
     Set an image with a URL, a place holder image, options and completion handler.
     
     :param: URL               The URL of image.
-    :param: placeHolderImage  A placeholder image when retrieving the image at URL.
+    :param: placeholderImage  A placeholder image when retrieving the image at URL.
     :param: options           Options which could control some behaviors. See `KingfisherOptions` for more.
     :param: completionHandler Called when the image retrieved and set.
     
     :returns: A task represents the retriving process.
     */
     public func kf_setImageWithURL(URL: NSURL,
-                      placeHolderImage: UIImage?,
+                      placeholderImage: UIImage?,
                                options: KingfisherOptions,
                      completionHandler: CompletionHandler?) -> RetrieveImageTask
     {
-        return kf_setImageWithURL(URL, placeHolderImage: placeHolderImage, options: options, progressBlock: nil, completionHandler: completionHandler)
+        return kf_setImageWithURL(URL, placeholderImage: placeholderImage, options: options, progressBlock: nil, completionHandler: completionHandler)
     }
     
     /**
     Set an image with a URL, a place holder image, options, progress handler and completion handler.
     
     :param: URL               The URL of image.
-    :param: placeHolderImage  A placeholder image when retrieving the image at URL.
+    :param: placeholderImage  A placeholder image when retrieving the image at URL.
     :param: options           Options which could control some behaviors. See `KingfisherOptions` for more.
     :param: progressBlock     Called when the image downloading progress gets updated.
     :param: completionHandler Called when the image retrieved and set.
@@ -105,18 +105,18 @@ public extension UIImageView {
     :returns: A task represents the retriving process.
     */
     public func kf_setImageWithURL(URL: NSURL,
-                      placeHolderImage: UIImage?,
+                      placeholderImage: UIImage?,
                                options: KingfisherOptions,
                          progressBlock: DownloadProgressBlock?,
                      completionHandler: CompletionHandler?) -> RetrieveImageTask
     {
-        image = placeHolderImage
+        image = placeholderImage
         
         self.kf_setWebURL(URL)
-        let task = KingfisherManager.sharedManager.retrieveImageWithURL(URL, options: options, progressBlock: { (recivedSize, totalSize) -> () in
+        let task = KingfisherManager.sharedManager.retrieveImageWithURL(URL, options: options, progressBlock: { (receivedSize, totalSize) -> () in
             if let progressBlock = progressBlock {
                 dispatch_async(dispatch_get_main_queue(), { () -> Void in
-                    progressBlock(receivedSize: recivedSize, totalSize: totalSize)
+                    progressBlock(receivedSize: receivedSize, totalSize: totalSize)
                 })
             }
         }) { (image, error, imageURL) -> () in