Add asyncStream and asyncThrowingStream for Signal and SignalProducer#847
Open
Add asyncStream and asyncThrowingStream for Signal and SignalProducer#847
asyncStream and asyncThrowingStream for Signal and SignalProducer#847Conversation
mluisbrown
reviewed
Nov 12, 2021
Member
Author
|
Interestingly the macCatalyst issue is known in Xcode 13.2 Beta |
NachoSoto
reviewed
Nov 27, 2021
|
|
||
| @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, *) | ||
| extension Signal { | ||
| public var asyncThrowingStream: AsyncThrowingStream<Value, Swift.Error> { |
Member
There was a problem hiding this comment.
I think we should use AsyncStream<Result<Value, Error>> to maintain the error type.
gshahbazian
reviewed
Apr 11, 2022
| switch event { | ||
| case .value(let value): | ||
| continuation.yield(value) | ||
| case .completed, .interrupted: |
There was a problem hiding this comment.
Should the interrupted event throw a swift CancellationError?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a proposal to add
asyncStreamandasyncThrowingStreamin order to bridge into Swift Concurrency.I find this especially useful for writing non-blocking async tests.
A couple of things I'd love to hear your thoughts on (apart from the usual review):
Note: Mac Catalyst builds are failing to launch on pre-monterey macOS versions: There is a workaround described in the documents but probably not worth implementing in the CI. More info here.