I am new to RxSwift and I would like to achieve something like this. Here's the situation
I have 2 different APIs that needs to populate in a UITableView. Therefore I need to combine 2 sets of data
I would like to achieve something like waiting 2 APIs finish returning the data only then I reload the UITableView once.
I've tried Observable.zip and Observable.combineLatest , but I still cannot get what I want.
Any one can help me on this ?
Edited Here's the idea of how I want it to be done
func viewDidLoad() {
setupObs()
getBalance()
getTransaction()
}
func getBalance() {
//Call get balance
}
func getTransaction() {
// Call get transaction
}
func setupObs() {
Observable.zip(
getBalance(),
getTransaction()
)
.subscribe(onNext: { bal, trx in
print("Done")
}, onCompleted: {
print("completed")
}).disposed(by: disposeBag)
}
The output "Done" is being printed twice