Skip to content

Commit

Permalink
Rename makeImageTask
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Aug 18, 2024
1 parent 38dc11c commit 2e0e6b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Sources/Nuke/Pipeline/ImagePipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/Nuke/Prefetching/ImagePrefetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2e0e6b6

Please sign in to comment.