Skip to content

Commit

Permalink
Fix all documentation warnings for Xcode 16
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Oct 12, 2024
1 parent 5387e7b commit 5407b11
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 30 deletions.
13 changes: 8 additions & 5 deletions Sources/Cache/DiskStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ public enum DiskStorage {
///
/// - Parameters:
/// - value: The value to be stored.
/// - key: The key to which the `value` will be stored. If there is already a value under the key,
/// the old value will be overwritten by the new `value`.
/// - key: The key to which the `value` will be stored. If there is already a value under the key, the old
/// value will be overwritten by the new `value`.
/// - expiration: The expiration policy used by this storage action.
/// - writeOptions: Data writing options used for the new files.
/// - forcedExtension: The file extension, if exists.
/// - Throws: An error during converting the value to a data format or during writing it to disk.
public func store(
value: T,
Expand Down Expand Up @@ -214,6 +215,7 @@ public enum DiskStorage {
/// Retrieves a value from the storage.
/// - Parameters:
/// - key: The cache key of the value.
/// - forcedExtension: The file extension, if exists.
/// - extendingExpiration: The expiration policy used by this retrieval action.
/// - Throws: An error during converting the data to a value or during the operation of disk files.
/// - Returns: The value under `key` if it is valid and found in the storage; otherwise, `nil`.
Expand Down Expand Up @@ -291,7 +293,8 @@ public enum DiskStorage {
/// - Returns: `true` if there is valid data under the key and file extension; otherwise, `false`.
///
/// > This method does not actually load the data from disk, so it is faster than directly loading the cached
/// value by checking the nullability of the ``DiskStorage/Backend/value(forKey:extendingExpiration:)`` method.
/// value by checking the nullability of the
/// ``DiskStorage/Backend/value(forKey:forcedExtension:extendingExpiration:)`` method.
public func isCached(forKey key: String, forcedExtension: String? = nil) -> Bool {
return isCached(forKey: key, referenceDate: Date(), forcedExtension: forcedExtension)
}
Expand All @@ -306,8 +309,8 @@ public enum DiskStorage {
/// - Returns: `true` if there is valid data under the key; otherwise, `false`.
///
/// If you pass `Date()` as the `referenceDate`, this method is identical to
/// ``DiskStorage/Backend/isCached(forKey:)``. Use the `referenceDate` to determine whether the cache is still
/// valid for a future date.
/// ``DiskStorage/Backend/isCached(forKey:forcedExtension:)``. Use the `referenceDate` to determine whether the
/// cache is still valid for a future date.
public func isCached(forKey key: String, referenceDate: Date, forcedExtension: String? = nil) -> Bool {
do {
let result = try value(
Expand Down
10 changes: 6 additions & 4 deletions Sources/Cache/ImageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ open class ImageCache: @unchecked Sendable {
/// as a result. Otherwise, a ``KingfisherError`` result with detailed failure reason will be sent.
///
/// > This method is marked as `open` for compatibility purposes only. Do not override this method. Instead,
/// override the version ``ImageCache/retrieveImage(forKey:options:callbackQueue:completionHandler:)-1m1bb`` that
/// override the version ``ImageCache/retrieveImageInDiskCache(forKey:options:callbackQueue:completionHandler:)``
/// accepts a ``KingfisherParsedOptionsInfo`` value.
open func retrieveImage(
forKey key: String,
Expand Down Expand Up @@ -938,7 +938,7 @@ open class ImageCache: @unchecked Sendable {
///
/// > The return value does not contain information about the kind of storage the cache matches from.
/// > To obtain information about the cache type according to ``CacheType``, use
/// ``ImageCache/imageCachedType(forKey:processorIdentifier:)`` instead.
/// ``ImageCache/imageCachedType(forKey:processorIdentifier:forcedExtension:)`` instead.
public func isCached(
forKey key: String,
processorIdentifier identifier: String = DefaultImageProcessor.default.identifier,
Expand Down Expand Up @@ -1009,7 +1009,7 @@ open class ImageCache: @unchecked Sendable {
/// > This method does not guarantee that there is an image already cached in the returned path. It simply provides
/// > the path where the image should be if it exists in the disk storage.
/// >
/// > You could use the ``ImageCache/isCached(forKey:processorIdentifier:)`` method to check whether the image is
/// > You could use the ``ImageCache/isCached(forKey:processorIdentifier:forcedExtension:)`` method to check whether the image is
/// cached under that key on disk if necessary.
open func cachePath(
forKey key: String,
Expand Down Expand Up @@ -1083,6 +1083,7 @@ open class ImageCache: @unchecked Sendable {
/// - key: The key used for caching the image.
/// - identifier: The identifier of the processor being used for caching. If you are using a processor for the
/// image, pass the identifier of the processor to this parameter.
/// - forcedExtension: The file extension, if exists.
/// - serializer: The ``CacheSerializer`` used to convert the `image` and `original` to the data that will be
/// stored to disk. By default, the ``DefaultCacheSerializer/default`` will be used.
/// - toDisk: Whether this image should be cached to disk or not. If `false`, the image is only cached in memory.
Expand Down Expand Up @@ -1138,6 +1139,7 @@ open class ImageCache: @unchecked Sendable {
/// - key: The key used for caching the image.
/// - identifier: The identifier of the processor being used for caching. If you are using a processor for the
/// image, pass the identifier of the processor to this parameter.
/// - forcedExtension: The file extension, if exists.
/// - fromMemory: Whether this image should be removed from memory storage or not. If `false`, the image won't be
/// removed from the memory storage. The default is `true`.
/// - fromDisk: Whether this image should be removed from the disk storage or not. If `false`, the image won't be
Expand Down Expand Up @@ -1196,7 +1198,7 @@ open class ImageCache: @unchecked Sendable {
/// - Throws: An error of type ``KingfisherError``, if any error happens inside Kingfisher framework.
///
/// > This method is marked as `open` for compatibility purposes only. Do not override this method. Instead,
/// override the version ``ImageCache/retrieveImage(forKey:options:callbackQueue:completionHandler:)-1m1bb`` that
/// override the version ``ImageCache/retrieveImage(forKey:options:callbackQueue:completionHandler:)-1jjo3`` that
/// accepts a ``KingfisherParsedOptionsInfo`` value.
open func retrieveImage(
forKey key: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class AsyncModifier: AsyncImageDownloadRequestModifier {
```

Similarly, use the ``KingfisherOptionsInfoItem/requestModifier(_:)`` to apply this modifier. In such scenarios, the
``KingfisherWrapper/setImage(with:placeholder:options:progressBlock:completionHandler:)-2uid3`` or
``ImageDownloader/downloadImage(with:options:completionHandler:)-5x6sa`` method will no longer return a ``DownloadTask``
``KingfisherWrapper/setImage(with:placeholder:options:progressBlock:completionHandler:)-8lmr3`` or
``ImageDownloader/downloadImage(with:options:completionHandler:)-2ztyq`` method will no longer return a ``DownloadTask``
directly, as the download task isn't initiated instantly. To reference the task, monitor the
``AsyncImageDownloadRequestModifier/onDownloadTaskStarted`` callback.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct MyProcessor: ImageProcessor {
}
```

Then pass it to the ``KingfisherWrapper/setImage(with:placeholder:options:completionHandler:)-3ft7a`` methods:
Then pass it to the ``KingfisherWrapper/setImage(with:placeholder:options:completionHandler:)-9h820`` methods:

```swift
let processor = MyProcessor(someValue: 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct MyCacheSerializer: CacheSerializer {
}
```

Then pass it to the ``KingfisherWrapper/setImage(with:placeholder:options:completionHandler:)-3ft7a`` methods:
Then pass it to the ``KingfisherWrapper/setImage(with:placeholder:options:completionHandler:)-9h820`` methods:

```swift
let serializer = MyCacheSerializer()
Expand Down
3 changes: 2 additions & 1 deletion Sources/General/KF.swift
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ extension KF.Builder {
#endif

/// Sets a placeholder image which is used while retrieving the image.
/// - Parameter placeholder: An image to show while retrieving the image from its source.
/// - Parameters:
/// - image: An image to show while retrieving the image from its source.
/// - Returns: A ``KF/Builder`` with changes applied.
public func placeholder(_ image: KFCrossPlatformImage?) -> Self {
self.placeholder = image
Expand Down
1 change: 0 additions & 1 deletion Sources/Networking/ImageDownloader+LivePhoto.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public struct LivePhotoResourceDownloadingResult: Sendable {
/// Creates an `ImageDownloadResult` object.
///
/// - Parameters:
/// - image: The image of the download result.
/// - url: The URL from which the image was downloaded.
/// - originalData: The binary data of the image.
public init(originalData: Data, url: URL? = nil) {
Expand Down
18 changes: 4 additions & 14 deletions Sources/Networking/ImageDownloaderDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,20 @@ public protocol ImageDownloaderDelegate: AnyObject {
didFinishDownloadingImageForURL url: URL,
with response: URLResponse?,
error: (any Error)?)

/// Called when the ``ImageDownloader`` object successfully downloads image data with a specified task.
///
/// This is your last chance to verify or modify the downloaded data before Kingfisher attempts to perform
/// This is your last chance to verify or modify the downloaded data before Kingfisher attempts to perform
/// additional processing on the image data.
///
/// - Parameters:
/// - downloader: The ``ImageDownloader`` object used for the downloading operation.
/// - data: The original downloaded data.
/// - dataTask: The data task containing request and response information for the download.
///
/// - task: The data task containing request and response information for the download.
/// - Returns: The data that Kingfisher should use to create an image. You need to provide valid data that is in
/// one of the supported image file formats. Kingfisher will process this data and attempt to convert it into an
/// image object.
///
///
/// This method can be used to preprocess raw image data before the creation of the `Image` instance (e.g.,
/// decrypting or verification). If `nil` is returned, the processing is interrupted and a
/// ``KingfisherError/ResponseErrorReason/dataModifyingFailed(task:)`` error will be raised. You can use this fact
/// to stop the image processing flow if you find that the data is corrupted or malformed.
///
/// > If this method is implemented, the `URL` version of
/// ``ImageDownloaderDelegate/imageDownloader(_:didDownload:for:)-5btcl`` will not be called anymore.
func imageDownloader(_ downloader: ImageDownloader, didDownload data: Data, with dataTask: SessionDataTask) -> Data?
func imageDownloader(_ downloader: ImageDownloader, didDownload data: Data, with task: SessionDataTask) -> Data?

/// Called when the ``ImageDownloader`` object successfully downloads image data from a specified URL.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/Networking/RedirectHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public struct AnyRedirectHandler: ImageDownloadRedirectHandler {

/// Creates a value of ``ImageDownloadRedirectHandler`` that executes the `modify` block.
///
/// - Parameter modify: The block that modifies the request when a request modification task is triggered.
/// - Parameter handle: The block that modifies the request when a request modification task is triggered.
public init(handle: @escaping @Sendable (SessionDataTask, HTTPURLResponse, URLRequest, @escaping (URLRequest?) -> Void) -> Void) {
block = handle
}
Expand Down

0 comments on commit 5407b11

Please sign in to comment.