Skip to content
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

Zip3 Operator #105

Closed
shahzadmajeed opened this issue Feb 22, 2021 · 3 comments · Fixed by #106
Closed

Zip3 Operator #105

shahzadmajeed opened this issue Feb 22, 2021 · 3 comments · Fixed by #106
Labels
bug Something isn't working

Comments

@shahzadmajeed
Copy link

shahzadmajeed commented Feb 22, 2021

Hi,

I am trying to test Zip3 operator and it doesn't seem to be working as expected:

My Code:

`var disposable: [AnyCancellable] = []
func testZip3() {

    let p1 = [3, 4, 5].cx.publisher
    let p2 = ["Hello", "World"].cx.publisher
    let p3 = [0.2, 0.6].cx.publisher

    Publishers.Zip3(p1, p2, p3)
    .print()
    .sink(receiveCompletion: { result in
        print(result)
    }, receiveValue: { (r1, r2, r3) in
        print(r1, r2, r3)
    })
    .store(in: &disposable)
}`

Output:
: receive subscription: (MapError) : request unlimited : receive finished finished

PS: Same code works fine when I use Apple Combine.

@ddddxxx ddddxxx added the bug Something isn't working label Feb 22, 2021
@ddddxxx
Copy link
Member

ddddxxx commented Feb 22, 2021

It seems Zip eagerly consumed all value from p1 and got .finished prematurely.

@ddddxxx
Copy link
Member

ddddxxx commented Feb 22, 2021

please try #106

@shahzadmajeed
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants