Observable.from()
can be used. It will convert a list into observable sequence of individual element. After all the operations use .toArray()
at the last which will again convert it into sequence of list.
func fetchGameDetailModelList(pageNo: Int) -> Observable<[GameDetailModel]> {
fetchAllGamesWithPagination(pageNo)
.flatMapLatest { listGames in
Observable.from(listGames)
.flatMap { fetchGameDetails($0.id) }
.toArray()
}
}
}