How to get response of a nested api call using RxSwift and alamofire? Here i get a response from an alamofire api cal and with that result i need to call another api call. I want to get the second api call response. Can anyone suggest me a solution to solve this. please.
func origin() -> Observable<String> {
return Alamofire.request("httpbin.org/get").rx.responseJSON()
}
func otherApiCall(with origin: String) -> Observable<YourType> {
// Other api call using origin
return Alamofire...........
}
then
origin()
.flatMap{ origin in
otherApiCall(with: origin)
}
.subscribe(onNext: { response in
})
.disposed(by: disposeBag)