I have an Observable
that combine three other Observables
then emit a single array
. From this merged array
I would like to take the last 10 objects. But I think I take the last ten arrays
instead. Tried using compactMap
first but that didn't do the trick. It's still returned as an array
return Observable.combineLatest(breakfast, dessert, cookies) { $0 + $1 + $2 }
.compactMap { $0 }.takeLast(10)
.do(onNext: { [weak self] value in
self?.content.accept(value.compactMap {
NewRecipesCollectionViewCellViewModel(recipe: $0)})
})