Browse Source

style: spelling and grammar check

YoloMao 2 years ago
parent
commit
927b276d75

+ 1 - 1
Sources/Cache/DiskStorage.swift

@@ -483,7 +483,7 @@ extension DiskStorage {
         /// Whether the cache file name will be hashed before storing.
         ///
         /// The default is `true`, which means that file name is hashed to protect user information (for example, the
-        /// orignial download URL which is used as the cache key).
+        /// original download URL which is used as the cache key).
         public var usesHashedFileName = true
 
         

+ 9 - 9
Sources/Cache/ImageCache.swift

@@ -724,7 +724,7 @@ open class ImageCache {
     // MARK: Cleaning
     /// Clears the memory and disk storage of this cache. 
     ///
-    /// This is an asynchronous operation. When the cache clearing opertaion finishes, the `handler` will be invoked.
+    /// This is an asynchronous operation. When the cache clearing operation finishes, the `handler` will be invoked.
     ///
     /// - Parameter handler: A closure that is invoked when the cache clearing operation finishes.
     ///                      This `handler` will be called from the main queue.
@@ -740,7 +740,7 @@ open class ImageCache {
     
     /// Clears the disk storage of this cache. 
     ///
-    /// This is an asynchronous operation. When the cache clearing opertaion finishes, the `handler` will be invoked.
+    /// This is an asynchronous operation. When the cache clearing operation finishes, the `handler` will be invoked.
     ///
     /// - Parameter handler: A closure that is invoked when the cache clearing operation finishes.
     ///                      This `handler` will be called from the main queue.
@@ -757,7 +757,7 @@ open class ImageCache {
     
     /// Clears the expired images from the memory and disk storage.
     ///
-    /// This is an asynchronous operation. When the cache clearing opertaion finishes, the `handler` will be invoked.
+    /// This is an asynchronous operation. When the cache clearing operation finishes, the `handler` will be invoked.
     open func cleanExpiredCache(completion handler: (() -> Void)? = nil) {
         cleanExpiredMemoryCache()
         cleanExpiredDiskCache(completion: handler)
@@ -777,7 +777,7 @@ open class ImageCache {
 
     /// Clears the expired images from disk storage.
     ///
-    /// This is an asynchronous operation. When the cache clearing opertaion finishes, the `handler` will be invoked.
+    /// This is an asynchronous operation. When the cache clearing operation finishes, the `handler` will be invoked.
     ///
     /// - Parameter handler: A closure which is invoked when the cache clearing operation finishes.
     ///                      This `handler` will be called from the main queue.
@@ -811,7 +811,7 @@ open class ImageCache {
 #if !os(macOS) && !os(watchOS)
     /// Clears the expired images from disk storage when the app is in the background. 
     ///
-    /// This is an asynchronous operation. When the cache clearing opertaion finishes, the `handler` will be invoked.
+    /// This is an asynchronous operation. When the cache clearing operation finishes, the `handler` will be invoked.
     ///
     /// In most cases, you should not call this method explicitly. It will be called automatically when a
     ///  `UIApplicationDidEnterBackgroundNotification` is received.
@@ -1120,7 +1120,7 @@ open class ImageCache {
     
     /// Clears the memory and disk storage of this cache.
     ///
-    /// This is an asynchronous operation. When the cache clearing opertaion finishes, the whole method returns.
+    /// This is an asynchronous operation. When the cache clearing operation finishes, the whole method returns.
     open func clearCache() async {
         await withCheckedContinuation {
             clearCache(completion: $0.resume)
@@ -1129,7 +1129,7 @@ open class ImageCache {
     
     /// Clears the disk storage of this cache.
     ///
-    /// This is an asynchronous operation. When the cache clearing opertaion finishes, the whole method returns.
+    /// This is an asynchronous operation. When the cache clearing operation finishes, the whole method returns.
     open func clearDiskCache() async {
         await withCheckedContinuation {
             clearDiskCache(completion: $0.resume)
@@ -1138,7 +1138,7 @@ open class ImageCache {
     
     /// Clears the expired images from the memory and disk storage.
     ///
-    /// This is an asynchronous operation. When the cache clearing opertaion finishes, the whole method returns.
+    /// This is an asynchronous operation. When the cache clearing operation finishes, the whole method returns.
     open func cleanExpiredCache() async {
         await withCheckedContinuation {
             cleanExpiredCache(completion: $0.resume)
@@ -1147,7 +1147,7 @@ open class ImageCache {
     
     /// Clears the expired images from disk storage.
     ///
-    /// This is an asynchronous operation. When the cache clearing opertaion finishes, the whole method returns.
+    /// This is an asynchronous operation. When the cache clearing operation finishes, the whole method returns.
     open func cleanExpiredDiskCache() async {
         await withCheckedContinuation {
             cleanExpiredDiskCache(completion: $0.resume)

+ 1 - 1
Sources/Cache/MemoryStorage.swift

@@ -55,7 +55,7 @@ public enum MemoryStorage {
         
         let storage = NSCache<NSString, StorageObject<T>>()
 
-        // Keys trackes the objects once inside the storage. 
+        // Keys track the objects once inside the storage.
         //
         // For object removing triggered by user, the corresponding key would be also removed. However, for the object
         // removing triggered by cache rule/policy of system, the key will be remained there until next `removeExpired`

+ 1 - 1
Sources/Cache/Storage.swift

@@ -120,6 +120,6 @@ public protocol DataTransformable {
     /// An empty object of `Self`.
     ///
     /// > In the cache, when the data is not actually loaded, this value will be returned as a placeholder.
-    /// > This varible should be returned quickly without any heavy operation inside.
+    /// > This variable should be returned quickly without any heavy operation inside.
     static var empty: Self { get }
 }

+ 1 - 1
Sources/General/ImageSource/AVAssetImageDataProvider.swift

@@ -95,7 +95,7 @@ public struct AVAssetImageDataProvider: ImageDataProvider {
     ///   - seconds: At which time in seconds in the asset the image should be generated.
     ///
     /// This method uses the `assetURL` parameter to create an `AVAssetImageGenerator` object, uses the `seconds`
-    /// paremeter to create a `CMTime`, then calls the ``init(assetImageGenerator:time:)`` initializer.
+    /// parameter to create a `CMTime`, then calls the ``init(assetImageGenerator:time:)`` initializer.
     ///
     public init(assetURL: URL, seconds: TimeInterval) {
         let time = CMTime(seconds: seconds, preferredTimescale: 600)

+ 1 - 1
Sources/General/ImageSource/ImageDataProvider.swift

@@ -166,7 +166,7 @@ public struct RawImageDataProvider: ImageDataProvider {
     /// Creates an image data provider by the given raw `data` value and a `cacheKey` be used in Kingfisher cache.
     ///
     /// - Parameters:
-    ///   - data: The raw data reprensents an image.
+    ///   - data: The raw data represents an image.
     ///   - cacheKey: The key is used for caching the image data. You need a different key for any different image.
     public init(data: Data, cacheKey: String) {
         self.data = data

+ 1 - 1
Sources/General/ImageSource/Resource.swift

@@ -45,7 +45,7 @@ extension Resource {
     /// ``Source/network(_:)`` is returned.
     ///
     /// - Parameter overrideCacheKey: The key should be used to override the ``Resource/cacheKey`` when performing the
-    /// conversion. `nil` if not overriden and ``Resource/cacheKey`` of `self` is used.
+    /// conversion. `nil` if not overridden and ``Resource/cacheKey`` of `self` is used.
     /// - Returns: The converted source.
     ///
     public func convertToSource(overrideCacheKey: String? = nil) -> Source {

+ 1 - 1
Sources/General/KingfisherError.swift

@@ -575,7 +575,7 @@ extension KingfisherError.ImageSettingErrorReason {
         case .dataProviderError(let provider, let error):
             return "Image data provider fails to provide data. Provider: \(provider), error: \(error)"
         case .alternativeSourcesExhausted(let errors):
-            return "Image setting from alternaive sources failed: \(errors)"
+            return "Image setting from alternative sources failed: \(errors)"
         }
     }
     

+ 2 - 2
Sources/General/KingfisherManager.swift

@@ -741,7 +741,7 @@ extension KingfisherManager {
     ///   contains an `expectedContentLength` and always runs on the main queue.
     ///
     /// - Returns: The ``RetrieveImageResult`` containing the retrieved image object and cache type.
-    /// - Throws: A ``KingfisherError`` if any issue occured during the image retrieving progress.
+    /// - Throws: A ``KingfisherError`` if any issue occurred during the image retrieving progress.
     ///
     /// - Note: This method first checks whether the requested `resource` is already in the cache. If it is cached,
     /// it returns `nil` and invokes the `completionHandler` after retrieving the cached image. Otherwise, it downloads
@@ -769,7 +769,7 @@ extension KingfisherManager {
     ///   contains an `expectedContentLength` and always runs on the main queue.
     ///
     /// - Returns: The ``RetrieveImageResult`` containing the retrieved image object and cache type.
-    /// - Throws: A ``KingfisherError`` if any issue occured during the image retrieving progress.
+    /// - Throws: A ``KingfisherError`` if any issue occurred during the image retrieving progress.
     ///
     /// - Note: This method first checks whether the requested `source` is already in the cache. If it is cached,
     /// it returns `nil` and invokes the `completionHandler` after retrieving the cached image. Otherwise, it downloads

+ 2 - 2
Sources/Image/ImageProgressive.swift

@@ -58,7 +58,7 @@ public struct ImageProgressive {
     
     /// A default `ImageProgressive` could be used across. It blurs the progressive loading with the fastest
     /// scan enabled and scan interval as 0.
-    @available(*, deprecated, message: "Getting a default `ImageProgressive` is deprecated due to its syntax symatic is not clear. Use `ImageProgressive.init` instead.", renamed: "init()")
+    @available(*, deprecated, message: "Getting a default `ImageProgressive` is deprecated due to its syntax semantic is not clear. Use `ImageProgressive.init` instead.", renamed: "init()")
     public static let `default` = ImageProgressive(
         isBlur: true,
         isFastestScan: true,
@@ -76,7 +76,7 @@ public struct ImageProgressive {
     
     /// Called when an intermediate image is prepared and about to be set to the image view. 
     ///
-    /// If implemneted, you should return an ``UpdatingStrategy`` value from this delegate. This value will be used to
+    /// If implemented, you should return an ``UpdatingStrategy`` value from this delegate. This value will be used to
     /// update the hosting view, if any. Otherwise, if there is no hosting view (i.e., the image retrieval is not
     /// happening from a view extension method), the returned ``UpdatingStrategy`` is ignored.
     public let onImageUpdated = Delegate<KFCrossPlatformImage, UpdatingStrategy>()

+ 3 - 3
Sources/Networking/ImageDownloader.swift

@@ -59,7 +59,7 @@ public struct ImageLoadingResult {
 
 /// Represents a task in the image downloading process.
 ///
-/// When a download starts in Kingfisher, the invovled methods always return you an instance of ``DownloadTask``. If you
+/// When a download starts in Kingfisher, the involved methods always return you an instance of ``DownloadTask``. If you
 /// need to cancel the task during the download process, you can keep a reference to the instance and call ``cancel()``
 /// on it.
 public class DownloadTask {
@@ -176,7 +176,7 @@ open class ImageDownloader {
         }
     }
     
-    /// The session delegate which is used to hadnle the session related tasks.
+    /// The session delegate which is used to handle the session related tasks.
     ///
     /// > Setting a new session delegate to the downloader will invalidate the existing session and create a new one 
     /// > with the new value and the ``sessionConfiguration``.
@@ -190,7 +190,7 @@ open class ImageDownloader {
     
     /// Whether the download requests should use pipeline or not. 
     ///
-    /// It sets the `httpShouldUsePipelining` of the `URLRequest` for the downlaod task. Default is false.
+    /// It sets the `httpShouldUsePipelining` of the `URLRequest` for the download task. Default is false.
     open var requestsUsePipelining = false
 
     /// The delegate of this `ImageDownloader` object.

+ 1 - 1
Sources/Networking/ImagePrefetcher.swift

@@ -350,7 +350,7 @@ public class ImagePrefetcher: CustomStringConvertible {
     
     private func reportCompletionOrStartNext() {
         if let resource = self.pendingSources.popFirst() {
-            // Loose call stack for huge ammount of sources.
+            // Loose call stack for huge amount of sources.
             prefetchQueue.async { self.startPrefetching(resource) }
         } else {
             guard allFinished else { return }

+ 1 - 1
Sources/Networking/SessionDataTask.swift

@@ -28,7 +28,7 @@ import Foundation
 
 /// Represents a session data task in ``ImageDownloader``.
 ///
-/// Essetially, a ``SessionDataTask`` wraps a `URLSessionDataTask` and manages the download data.
+/// Essentially, a ``SessionDataTask`` wraps a `URLSessionDataTask` and manages the download data.
 /// It uses a ``SessionDataTask/CancelToken`` to track the task and manage its cancellation.
 public class SessionDataTask {
 

+ 5 - 5
Tests/KingfisherTests/DataReceivingSideEffectTests.swift

@@ -80,13 +80,13 @@ class DataReceivingSideEffectTests: XCTestCase {
         let url = testURLs[0]
         stub(url, data: testImageData, length: 123)
 
-        let receiver = DataReceivingNotAppyStub()
+        let receiver = DataReceivingNotApplyStub()
 
         let options: KingfisherOptionsInfo = [/*.onDataReceived([receiver]),*/ .waitForCache]
         KingfisherManager.shared.retrieveImage(with: url, options: options) {
             result in
             XCTAssertTrue(receiver.called)
-            XCTAssertFalse(receiver.appied)
+            XCTAssertFalse(receiver.applied)
             exp.fulfill()
         }
         waitForExpectations(timeout: 3, handler: nil)
@@ -101,17 +101,17 @@ class DataReceivingStub: DataReceivingSideEffect {
     }
 }
 
-class DataReceivingNotAppyStub: DataReceivingSideEffect {
+class DataReceivingNotApplyStub: DataReceivingSideEffect {
 
     var called: Bool = false
-    var appied: Bool = false
+    var applied: Bool = false
 
     var onShouldApply: () -> Bool = { return false }
 
     func onDataReceived(_ session: URLSession, task: SessionDataTask, data: Data) {
         called = true
         if onShouldApply() {
-            appied = true
+            applied = true
         }
     }
 }

+ 2 - 2
Tests/KingfisherTests/ImageCacheTests.swift

@@ -310,7 +310,7 @@ class ImageCacheTests: XCTestCase {
         XCTAssertTrue(cachePath.hasSuffix(".jpg"))
     }
   
-    func testCachedImageIsFetchedSyncronouslyFromTheMemoryCache() {
+    func testCachedImageIsFetchedSynchronouslyFromTheMemoryCache() {
         cache.store(testImage, forKey: testKeys[0], toDisk: false)
         var foundImage: KFCrossPlatformImage?
         cache.retrieveImage(forKey: testKeys[0]) { result in
@@ -319,7 +319,7 @@ class ImageCacheTests: XCTestCase {
         XCTAssertEqual(testImage, foundImage)
     }
     
-    func testCachedImageIsFetchedSyncronouslyFromTheMemoryCacheAsync() async throws {
+    func testCachedImageIsFetchedSynchronouslyFromTheMemoryCacheAsync() async throws {
         try await cache.store(testImage, forKey: testKeys[0], toDisk: false)
         let result = try await cache.retrieveImage(forKey: testKeys[0])
         XCTAssertEqual(testImage, result.image)

+ 5 - 5
Tests/KingfisherTests/ImageDownloaderTests.swift

@@ -159,7 +159,7 @@ class ImageDownloaderTests: XCTestCase {
             downloadTaskCalled = true
         }
 
-        let someURL = URL(string: "some_strage_url")!
+        let someURL = URL(string: "some_strange_url")!
         let task = downloader.downloadImage(with: someURL, options: [.requestModifier(asyncModifier)]) { result in
             XCTAssertNotNil(result.value)
             XCTAssertEqual(result.value?.url, url)
@@ -444,13 +444,13 @@ class ImageDownloaderTests: XCTestCase {
         stub(url, data: testImageData)
 
         let p = RoundCornerImageProcessor(cornerRadius: 40)
-        let roundcornered = testImage.kf.image(withRoundRadius: 40, fit: testImage.kf.size)
+        let roundCornered = testImage.kf.image(withRoundRadius: 40, fit: testImage.kf.size)
         
         downloader.downloadImage(with: url, options: [.processor(p)]) { result in
             XCTAssertNotNil(result.value)
             let image = result.value!.image
             XCTAssertFalse(image.renderEqual(to: testImage))
-            XCTAssertTrue(image.renderEqual(to: roundcornered))
+            XCTAssertTrue(image.renderEqual(to: roundCornered))
             XCTAssertEqual(result.value!.originalData, testImageData)
             exp.fulfill()
         }
@@ -464,7 +464,7 @@ class ImageDownloaderTests: XCTestCase {
         let stub = delayedStub(url, data: testImageData)
 
         let p1 = RoundCornerImageProcessor(cornerRadius: 40)
-        let roundcornered = testImage.kf.image(withRoundRadius: 40, fit: testImage.kf.size)
+        let roundCornered = testImage.kf.image(withRoundRadius: 40, fit: testImage.kf.size)
 
         let p2 = BlurImageProcessor(blurRadius: 3.0)
         let blurred = testImage.kf.blurred(withRadius: 3.0)
@@ -473,7 +473,7 @@ class ImageDownloaderTests: XCTestCase {
 
         group.enter()
         let task1 = downloader.downloadImage(with: url, options: [.processor(p1)]) { result in
-            XCTAssertTrue(result.value!.image.renderEqual(to: roundcornered))
+            XCTAssertTrue(result.value!.image.renderEqual(to: roundCornered))
             group.leave()
         }
 

+ 3 - 3
Tests/KingfisherTests/ImageViewExtensionTests.swift

@@ -347,7 +347,7 @@ class ImageViewExtensionTests: XCTestCase {
         waitForExpectations(timeout: 3, handler: nil)
     }
     
-    func testDownloadForMutipleURLs() {
+    func testDownloadForMultipleURLs() {
         let exp = expectation(description: #function)
 
         stub(testURLs[0], data: testImageData)
@@ -357,7 +357,7 @@ class ImageViewExtensionTests: XCTestCase {
         
         group.enter()
         imageView.kf.setImage(with: testURLs[0]) { result in
-            // The download successed, but not the resource we want.
+            // The download succeeded, but not with the resource we want.
             XCTAssertNotNil(result.error)
             if case .imageSettingError(
                 reason: .notCurrentSourceTask(let result, _, let source)) = result.error!
@@ -884,7 +884,7 @@ class ImageViewExtensionTests: XCTestCase {
                 XCTFail("The error should be a task cancelled.")
                 return
             }
-            XCTAssertEqual(task.task.originalRequest?.url, url, "Should be the alternatived url cancelled.")
+            XCTAssertEqual(task.task.originalRequest?.url, url, "Should be the alternative url cancelled.")
         }
 
         waitForExpectations(timeout: 1, handler: nil)

+ 3 - 3
Tests/KingfisherTests/KingfisherManagerTests.swift

@@ -230,7 +230,7 @@ class KingfisherManagerTests: XCTestCase {
         }
     }
     
-    func testSuccessCompletionHandlerRunningOnMainQueueDefaultly() {
+    func testSuccessCompletionHandlerRunningOnMainQueueByDefault() {
         let progressExpectation = expectation(description: "progressBlock running on main queue")
         let completionExpectation = expectation(description: "completionHandler running on main queue")
 
@@ -267,7 +267,7 @@ class KingfisherManagerTests: XCTestCase {
         waitForExpectations(timeout: 3, handler: nil)
     }
 
-    func testErrorCompletionHandlerRunningOnMainQueueDefaultly() {
+    func testErrorCompletionHandlerRunningOnMainQueueByDefault() {
         let exp = expectation(description: #function)
         let url = testURLs[0]
         stub(url, data: testImageData, statusCode: 404)
@@ -281,7 +281,7 @@ class KingfisherManagerTests: XCTestCase {
         waitForExpectations(timeout: 3, handler: nil)
     }
 
-    func testSucessCompletionHandlerRunningOnCustomQueue() {
+    func testSuccessCompletionHandlerRunningOnCustomQueue() {
         let progressExpectation = expectation(description: "progressBlock running on custom queue")
         let completionExpectation = expectation(description: "completionHandler running on custom queue")
 

+ 1 - 1
Tests/KingfisherTests/MemoryStorageTests.swift

@@ -69,7 +69,7 @@ class MemoryStorageTests: XCTestCase {
         XCTAssertEqual(storage.value(forKey: "1"), 1)
     }
 
-    func testStoreValueOverwritting() {
+    func testStoreValueOverwriting() {
         storage.store(value: 1, forKey: "1")
         XCTAssertEqual(storage.value(forKey: "1"), 1)
 

+ 2 - 2
Tests/KingfisherTests/NSButtonExtensionTests.swift

@@ -106,7 +106,7 @@ class NSButtonExtensionTests: XCTestCase {
         waitForExpectations(timeout: 5, handler: nil)
     }
 
-    func testCacnelImageTask() {
+    func testCancelImageTask() {
         let exp = expectation(description: #function)
         let url = testURLs[0]
         let stub = delayedStub(url, data: testImageData)
@@ -123,7 +123,7 @@ class NSButtonExtensionTests: XCTestCase {
         waitForExpectations(timeout: 3, handler: nil)
     }
 
-    func testCacnelAlternateImageTask() {
+    func testCancelAlternateImageTask() {
         let exp = expectation(description: #function)
         let url = testURLs[0]
         let stub = delayedStub(url, data: testImageData)

+ 2 - 2
Tests/KingfisherTests/RetryStrategyTests.swift

@@ -115,7 +115,7 @@ class RetryStrategyTests: XCTestCase {
         )
         retry.retry(context: context1) { decision in
             guard case RetryDecision.retry(let userInfo) = decision else {
-                XCTFail("The deicision should be `retry`")
+                XCTFail("The decision should be `retry`")
                 return
             }
             XCTAssertNil(userInfo)
@@ -131,7 +131,7 @@ class RetryStrategyTests: XCTestCase {
         context2.increaseRetryCount() // 3
         retry.retry(context: context2) { decision in
             guard case RetryDecision.stop = decision else {
-                XCTFail("The deicision should be `stop`")
+                XCTFail("The decision should be `stop`")
                 return
             }
             blockCalled.append(true)

+ 2 - 2
Tests/KingfisherTests/UIButtonExtensionTests.swift

@@ -110,7 +110,7 @@ class UIButtonExtensionTests: XCTestCase {
         waitForExpectations(timeout: 3, handler: nil)
     }
     
-    func testCacnelImageTask() {
+    func testCancelImageTask() {
         let exp = expectation(description: #function)
         let url = testURLs[0]
         let stub = delayedStub(url, data: testImageData)
@@ -128,7 +128,7 @@ class UIButtonExtensionTests: XCTestCase {
         waitForExpectations(timeout: 3, handler: nil)
     }
     
-    func testCacnelBackgroundImageTask() {
+    func testCancelBackgroundImageTask() {
         let exp = expectation(description: #function)
         let url = testURLs[0]
         let stub = delayedStub(url, data: testImageData)