let p1: PassthroughSubject<Int, Never> = .init()
let p2: PassthroughSubject<Bool, Never> = .init()
var pub1: AnyPublisher<Int, Never> {
return p1.eraseToAnyPublisher()
}
var pub2: AnyPublisher<Bool, Never> {
return p2.eraseToAnyPublisher()
}
var sub: AnyCancellable?
sub = Publishers.CombineLatest(pub1, pub2).sink(receiveValue: { output in
print("output: \(output)")
})
p1.send(4)
// nothing printed
p2.send(false)
// printed: output: (4, false)
why is there no output when p1 sends 4? How should I structure the code such that when either p1 pr p2 sends a value, there is an output?