I am using RxSwift 2.0.0-beta p>
How can I combine 2 observable different types as zip?
The current workaround I have is to map everything to an extra tuple that combines the types, and then replace the optional tuples with the optional one.
let intObs = just(1) .map { int -> (int: Int?, string: String?) in return (int: int, string: nil) } let stringObs = just("string") .map { string -> (int: Int?, string: String?) in return (int: nil, string: string) } [intObs, stringObs].zip { (optionalPairs) -> (int: Int, string: String) in return (int: optionalPairs[0].int!, string: optionalPairs[1].string!) }
This is clearly pretty ugly. What is the best way?
source share