Created
September 12, 2020 07:42
-
-
Save ivangodfather/53f0c521113b06398e175b3208b549bf to your computer and use it in GitHub Desktop.
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
import Combine | |
var cancellables = Set<AnyCancellable>() | |
let test = [1, 2, 3, 4].publisher | |
.delay(for: .seconds(2), scheduler: DispatchQueue.global()) | |
.print() | |
.share() | |
test.sink { value in | |
print("1: \(value)") | |
}.store(in: &cancellables) | |
test.sink { value in | |
print("2: \(value)") | |
}.store(in: &cancellables) | |
receive subscription: (Combine.Publishers.Delay<Combine.Publishers.Sequence<Swift.Array<Swift.Int>, Swift.Never>, __C.OS_dispatch_queue>.(unknown context at $7fff233497ac).Inner<Combine.Publishers.Print<Combine.Publishers.Delay<Combine.Publishers.Sequence<Swift.Array<Swift.Int>, Swift.Never>, __C.OS_dispatch_queue>>.(unknown context at $7fff2333cf5c).Inner<Combine.SubjectSubscriber<Combine.PassthroughSubject<Swift.Int, Swift.Never>>>>) | |
request unlimited | |
receive value: (1) | |
1: 1 | |
2: 1 | |
receive value: (2) | |
1: 2 | |
2: 2 | |
receive value: (3) | |
1: 3 | |
2: 3 | |
receive finished | |
receive value: (4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment