In Combine there are (among others) these two publishers:
let just = Just("Just")
let future = Future<String, Never>({ (promise) in
DispatchQueue.main.async {
promise(.success("Future"))
}
})
These two have a different output when put into a combineLatest publisher like in the following
just.combineLatest([1,2,3].publisher).sink { (value) in
print(value)
}.store(in: &bin)
/* prints
("Just", 1)
("Just", 2)
("Just", 3)
*/
future.combineLatest([1,2,3].publisher).sink { (value) in
print(value)
}.store(in: &bin)
/* prints:
("Future", 3)
*/
Is there any way to modify (e.g. an operator) the Future publisher in a way so that it will behave like the Just publisher?