-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add merge operator for SignalProducer #2925
add merge operator for SignalProducer #2925
Conversation
/// from each of them, and complete when all of them have completed. | ||
@warn_unused_result(message="Did you forget to call `start` on the producer?") | ||
public static func merge<Value, Error: ErrorType>(producers: SignalProducer<Value, Error>...) -> SignalProducer<Value, Error> { | ||
return SignalProducer(values: producers).flatten(.Merge) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could just call the above variant and pass producers
.
Thanks for the PR! I agree this is a handy thing to have. |
Thank you for the comments! I've updated this PR according to your comments. |
What do you think about the case when Maybe it's better to move |
@larryonoff That should be discussed in #2926. |
@ikesyo thanks! |
@@ -1893,6 +1893,71 @@ class SignalProducerSpec: QuickSpec { | |||
expect(started) == false | |||
} | |||
} | |||
|
|||
describe("SignalProducer.merge") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this (and describe("Signal.merge")
in SignalSpec.swift
) should be defined in FlattenSpec.swift
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will move it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
This is great! Thanks for the PR. ✨ |
It often usable to use merge operator for SignalProducer.
Signal
already has merge operator.