diff --git a/Sources/Nuke/AsyncImageTask.swift b/Sources/Nuke/AsyncImageTask.swift index 2f40fb2d7..c5679d180 100644 --- a/Sources/Nuke/AsyncImageTask.swift +++ b/Sources/Nuke/AsyncImageTask.swift @@ -3,6 +3,7 @@ // Copyright (c) 2015-2024 Alexander Grebenyuk (github.com/kean). import Foundation +import Combine #if canImport(UIKit) import UIKit diff --git a/Sources/Nuke/Internal/Extensions.swift b/Sources/Nuke/Internal/Extensions.swift index 5801f1b01..03b46dc5f 100644 --- a/Sources/Nuke/Internal/Extensions.swift +++ b/Sources/Nuke/Internal/Extensions.swift @@ -61,13 +61,3 @@ final class AnonymousCancellable: Cancellable { onCancel() } } - -extension AsyncStream { - static func pipe() -> (Self, Self.Continuation?) { - var continuation: Self.Continuation? // Should not be nil - let stream = Self { - continuation = $0 - } - return (stream, continuation) - } -} diff --git a/Sources/Nuke/Pipeline/ImagePipeline.swift b/Sources/Nuke/Pipeline/ImagePipeline.swift index 80c7ed900..d766b4b0b 100644 --- a/Sources/Nuke/Pipeline/ImagePipeline.swift +++ b/Sources/Nuke/Pipeline/ImagePipeline.swift @@ -125,7 +125,7 @@ public final class ImagePipeline: @unchecked Sendable { /// Creates a task with the given request. public func imageTask(with request: ImageRequest) -> AsyncImageTask { let imageTask = makeImageTask(request: request) - let (events, continuation) = AsyncStream.pipe() + let (events, continuation) = AsyncStream.makeStream(of: ImageTask.Event.self) let task = Task { try await response(for: imageTask, stream: continuation) }