Skip to content

Commit

Permalink
Remove AsyncStream.pipe and replace with standard makeStream(of:)
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Apr 28, 2024
1 parent b37eeac commit 2c852a6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
1 change: 1 addition & 0 deletions Sources/Nuke/AsyncImageTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Copyright (c) 2015-2024 Alexander Grebenyuk (github.com/kean).

import Foundation
import Combine

#if canImport(UIKit)
import UIKit
Expand Down
10 changes: 0 additions & 10 deletions Sources/Nuke/Internal/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion Sources/Nuke/Pipeline/ImagePipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<ImageTask.Event>.pipe()
let (events, continuation) = AsyncStream.makeStream(of: ImageTask.Event.self)
let task = Task<ImageResponse, Swift.Error> {
try await response(for: imageTask, stream: continuation)
}
Expand Down

0 comments on commit 2c852a6

Please sign in to comment.