Skip to content

Commit

Permalink
style: spelling and grammar check
Browse files Browse the repository at this point in the history
  • Loading branch information
YoloMao committed Dec 25, 2023
1 parent cee6fd4 commit 927b276
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Sources/Cache/DiskStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
18 changes: 9 additions & 9 deletions Sources/Cache/ImageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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)
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Cache/MemoryStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion Sources/Cache/Storage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
2 changes: 1 addition & 1 deletion Sources/General/ImageSource/AVAssetImageDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Sources/General/ImageSource/ImageDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/General/ImageSource/Resource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Sources/General/KingfisherError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/General/KingfisherManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/Image/ImageProgressive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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>()
Expand Down
6 changes: 3 additions & 3 deletions Sources/Networking/ImageDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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``.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Networking/ImagePrefetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion Sources/Networking/SessionDataTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
10 changes: 5 additions & 5 deletions Tests/KingfisherTests/DataReceivingSideEffectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}
}
}
4 changes: 2 additions & 2 deletions Tests/KingfisherTests/ImageCacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions Tests/KingfisherTests/ImageDownloaderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
}
Expand All @@ -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)
Expand All @@ -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()
}

Expand Down
6 changes: 3 additions & 3 deletions Tests/KingfisherTests/ImageViewExtensionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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!
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Tests/KingfisherTests/KingfisherManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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)
Expand All @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion Tests/KingfisherTests/MemoryStorageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading

0 comments on commit 927b276

Please sign in to comment.