Example 1:
let future1 = Future<String, Never> { promise in
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
promise(.success("hello"))
}
}
let future2 = Future<String, Never> { promise in
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
promise(.success("world"))
}
}
let publisherZipped = Publishers.Zip(future1, future2)
.sink { print("\($0.0) \($0.1)") }
Result: “hello world” after 10 second.