1
1
mirror of https://github.com/kean/Nuke.git synced 2024-11-28 12:04:01 +03:00

Rename makeImageTask

This commit is contained in:
kean 2024-08-18 13:45:06 -04:00
parent 38dc11c550
commit 2e0e6b6c71
2 changed files with 5 additions and 5 deletions

View File

@ -114,7 +114,7 @@ public final class ImagePipeline {
///
/// The task starts executing the moment it is created.
public nonisolated func imageTask(with request: ImageRequest) -> ImageTask {
makeStartedImageTask(with: request)
makeImageTask(with: request)
}
/// Returns an image for the given URL.
@ -133,7 +133,7 @@ public final class ImagePipeline {
///
/// - parameter request: An image request.
public func data(for request: ImageRequest) async throws -> (Data, URLResponse?) {
let task = makeStartedImageTask(with: request, isDataTask: true)
let task = makeImageTask(with: request, isDataTask: true)
let response = try await task.response
return (response.container.data ?? Data(), response.urlResponse)
}
@ -190,7 +190,7 @@ public final class ImagePipeline {
progress: (@MainActor @Sendable (ImageResponse?, ImageTask.Progress) -> Void)?,
completion: @MainActor @Sendable @escaping (Result<ImageResponse, Error>) -> Void
) -> ImageTask {
makeStartedImageTask(with: request, isDataTask: isDataTask) { event, task in
makeImageTask(with: request, isDataTask: isDataTask) { event, task in
DispatchQueue.main.async {
// The callback-based API guarantees that after cancellation no
// event are called on the callback queue.
@ -236,7 +236,7 @@ public final class ImagePipeline {
// MARK: - ImageTask (Internal)
nonisolated func makeStartedImageTask(with request: ImageRequest, isDataTask: Bool = false, onEvent: ((ImageTask.Event, ImageTask) -> Void)? = nil) -> ImageTask {
nonisolated func makeImageTask(with request: ImageRequest, isDataTask: Bool = false, onEvent: ((ImageTask.Event, ImageTask) -> Void)? = nil) -> ImageTask {
let task = ImageTask(taskId: nextTaskId.incremented(), request: request, isDataTask: isDataTask, pipeline: self, onEvent: onEvent)
delegate.imageTaskCreated(task, pipeline: self)
return task

View File

@ -145,7 +145,7 @@ public final class ImagePrefetcher {
// TODO: (nuke13) verify that this works
private func loadImage(task: PrefetchTask, finish: @escaping () -> Void) {
let imageTask = pipeline.makeStartedImageTask(with: task.request, isDataTask: destination == .diskCache)
let imageTask = pipeline.makeImageTask(with: task.request, isDataTask: destination == .diskCache)
task.imageTask = imageTask
Task { [weak self] in
_ = try? await imageTask.response