Hello,
I’m working my way through ch 12 and got confused with a piece of code.
let search = searchCityName.rx.text
.filter { ($0 ?? "").characters.count > 0 }
.flatMapLatest { text in
return ApiController.shared.currentWeather(city: text ?? "Error")
.catchErrorJustReturn(ApiController.Weather.empty)
}
.shareReplay(1)
.observeOn(MainScheduler.instance)
According to details, flatMapLatest is used to make it multi-used observable. However, what confuses me is we’re not dealing with multiple observables here. It’s just a single observable searchCityName.rx.text
we’re subscribing to. Please explain. Thanks.