Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: spelling and grammar check #2185

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Cache/CacheSerializer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public struct DefaultCacheSerializer: CacheSerializer {
/// In that case, the serialization will fall back to creating data from image.
public var preferCacheOriginalData: Bool = false

/// Returnes the `preferCacheOriginalData` value. When the original data is used, Kingfisher needs to re-apply the
/// Returns the `preferCacheOriginalData` value. When the original data is used, Kingfisher needs to re-apply the
/// processors to get the desired final image.
public var originalDataUsed: Bool { preferCacheOriginalData }

Expand Down
2 changes: 1 addition & 1 deletion Sources/Cache/DiskStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ extension DiskStorage {

/// Default is `false`
/// If set to `true`, image extension will be extracted from original file name and append to
/// the hased file name and used as the cache key on disk.
/// the hashed file name and used as the cache key on disk.
public var autoExtAfterHashedFileName = false

/// Closure that takes in initial directory path and generates
Expand Down
4 changes: 2 additions & 2 deletions Sources/Cache/ImageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ open class ImageCache {
/// will be sent to this closure as result. Otherwise, a `KingfisherError` result
/// with detail failing reason will be sent.
///
/// Note: This method is marked as `open` for only compatible purpose. Do not overide this method. Instead, override
/// Note: This method is marked as `open` for only compatible purpose. Do not override this method. Instead, override
/// the version receives `KingfisherParsedOptionsInfo` instead.
open func retrieveImage(forKey key: String,
options: KingfisherOptionsInfo? = nil,
Expand Down Expand Up @@ -585,7 +585,7 @@ open class ImageCache {
/// - Returns: The image stored in memory cache, if exists and valid. Otherwise, if the image does not exist or
/// has already expired, `nil` is returned.
///
/// Note: This method is marked as `open` for only compatible purpose. Do not overide this method. Instead, override
/// Note: This method is marked as `open` for only compatible purpose. Do not override this method. Instead, override
/// the version receives `KingfisherParsedOptionsInfo` instead.
open func retrieveImageInMemoryCache(
forKey key: String,
Expand Down
2 changes: 1 addition & 1 deletion Sources/Cache/MemoryStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public enum MemoryStorage {
public class Backend<T: CacheCostCalculable> {
let storage = NSCache<NSString, StorageObject<T>>()

// Keys trackes the objects once inside the storage. For object removing triggered by user, the corresponding
// 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` happens.
//
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 @@ -172,7 +172,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/KFOptionsSetter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ extension KFOptionSetter {
/// - Returns: A `Self` value with changes applied.
/// If set, options will be passed the store operation for a new files.
///
/// This is useful if you want to implement file enctyption on first write - eg [.completeFileProtection]
/// This is useful if you want to implement file encryption on first write - eg [.completeFileProtection]
///
public func diskStoreWriteOptions(_ writingOptions: Data.WritingOptions) -> Self {
options.diskStoreWriteOptions = writingOptions
Expand Down
2 changes: 1 addition & 1 deletion Sources/General/KingfisherError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,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
2 changes: 1 addition & 1 deletion Sources/General/KingfisherManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public struct RetrieveImageResult {
/// Gets the data behind the result.
///
/// If this result is from a network downloading (when `cacheType == .none`), calling this returns the downloaded
/// data. If the reuslt is from cache, it serializes the image with the given cache serializer in the loading option
/// data. If the result is from cache, it serializes the image with the given cache serializer in the loading option
/// and returns the result.
///
/// - Note:
Expand Down
2 changes: 1 addition & 1 deletion Sources/Image/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ extension KingfisherWrapper where Base: KFCrossPlatformImage {
/// input image in pixel format. It does downsampling from the image data, so it is much
/// more memory efficient and friendly. Choose to use downsampling as possible as you can.
///
/// The pointsize should be smaller than the size of input image. If it is larger than the
/// The point size should be smaller than the size of input image. If it is larger than the
/// original image size, the result image will be the same size of input without downsampling.
public static func downsampledImage(data: Data, to pointSize: CGSize, scale: CGFloat) -> KFCrossPlatformImage? {
let imageSourceOptions = [kCGImageSourceShouldCache: false] as CFDictionary
Expand Down
2 changes: 1 addition & 1 deletion Sources/Image/ImageProcessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ public struct ResizingImageProcessor: ImageProcessor {
}
}

/// Processor for adding blur effect to images. `Accelerate.framework` is used underhood for
/// Processor for adding blur effect to images. `Accelerate.framework` is used under the hood for
/// a better performance. A simulated Gaussian blur with specified blur radius will be applied.
public struct BlurImageProcessor: ImageProcessor {

Expand Down
2 changes: 1 addition & 1 deletion Sources/Image/ImageProgressive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,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 Down
4 changes: 2 additions & 2 deletions Sources/Networking/ImagePrefetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public class ImagePrefetcher: CustomStringConvertible {
}
}

/// Stops current downloading progress, and cancel any future prefetching activity that might be occuring.
/// Stops current downloading progress, and cancel any future prefetching activity that might be occurring.
public func stop() {
prefetchQueue.async {
if self.finished { return }
Expand Down Expand Up @@ -409,7 +409,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/RedirectHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Foundation
public protocol ImageDownloadRedirectHandler {

/// The `ImageDownloadRedirectHandler` contained will be used to change the request before redirection.
/// This is the posibility you can modify the image download request during redirection. You can modify the
/// This is the possibility you can modify the image download request during redirection. You can modify the
/// request for some customizing purpose, such as adding auth token to the header, do basic HTTP auth or
/// something like url mapping.
///
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
}
}
}
2 changes: 1 addition & 1 deletion Tests/KingfisherTests/ImageCacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class ImageCacheTests: XCTestCase {
}


func testCachedImageIsFetchedSyncronouslyFromTheMemoryCache() {
func testCachedImageIsFetchedSynchronouslyFromTheMemoryCache() {
cache.store(testImage, forKey: testKeys[0], toDisk: false)
var foundImage: KFCrossPlatformImage?
cache.retrieveImage(forKey: testKeys[0]) { result in
Expand Down
10 changes: 5 additions & 5 deletions Tests/KingfisherTests/ImageDownloaderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class ImageDownloaderTests: XCTestCase {
}


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 @@ -412,13 +412,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 @@ -432,7 +432,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 @@ -441,7 +441,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 Down Expand Up @@ -837,7 +837,7 @@ class ImageViewExtensionTests: XCTestCase {
let url = testURLs[0]
stub(url, data: testImageData)

let brokenURL = URL(string: "brokenurl")!
let brokenURL = URL(string: "broken_url")!
stub(brokenURL, data: Data())

imageView.kf.setImage(
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 canceled.")
}

waitForExpectations(timeout: 1, handler: nil)
Expand Down
16 changes: 8 additions & 8 deletions Tests/KingfisherTests/KingfisherManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class KingfisherManagerTests: XCTestCase {
waitForExpectations(timeout: 3, handler: nil)
}

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 @@ -186,7 +186,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 @@ -200,7 +200,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 Expand Up @@ -811,7 +811,7 @@ class KingfisherManagerTests: XCTestCase {
let url = testURLs[0]
stub(url, data: testImageData)

let brokenURL = URL(string: "brokenurl")!
let brokenURL = URL(string: "broken_url")!
stub(brokenURL, data: Data())

_ = manager.retrieveImage(
Expand All @@ -835,7 +835,7 @@ class KingfisherManagerTests: XCTestCase {
let url = testURLs[0]
stub(url, data: Data())

let brokenURL = URL(string: "brokenurl")!
let brokenURL = URL(string: "broken_url")!
stub(brokenURL, data: Data())

let anotherBrokenURL = URL(string: "anotherBrokenURL")!
Expand Down Expand Up @@ -876,7 +876,7 @@ class KingfisherManagerTests: XCTestCase {
let url = testURLs[0]
stub(url, data: testImageData)

let brokenURL = URL(string: "brokenurl")!
let brokenURL = URL(string: "broken_url")!
stub(brokenURL, data: Data())

var downloadTaskUpdatedCount = 0
Expand All @@ -903,7 +903,7 @@ class KingfisherManagerTests: XCTestCase {
let url = testURLs[0]
stub(url, data: testImageData)

let brokenURL = URL(string: "brokenurl")!
let brokenURL = URL(string: "broken_url")!
stub(brokenURL, data: Data())

let task = manager.retrieveImage(
Expand All @@ -926,7 +926,7 @@ class KingfisherManagerTests: XCTestCase {
let url = testURLs[0]
let dataStub = delayedStub(url, data: testImageData)

let brokenURL = URL(string: "brokenurl")!
let brokenURL = URL(string: "broken_url")!
stub(brokenURL, data: Data())

var task: DownloadTask!
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
4 changes: 2 additions & 2 deletions Tests/KingfisherTests/NSButtonExtensionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Tests/KingfisherTests/RetryStrategyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class RetryStrategyTests: XCTestCase {
func testKingfisherManagerCanRetry() {
let exp = expectation(description: #function)

let brokenURL = URL(string: "brokenurl")!
let brokenURL = URL(string: "broken_url")!
stub(brokenURL, data: Data())

let retry = StubRetryStrategy()
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Tests/KingfisherTests/UIButtonExtensionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down