LeTadas
LeTadas

Reputation: 3556

RxSwift can't find flatMapObservable

Single.flatMapObservable

in RxSwift is it called differently or it just doesn't exist?

Upvotes: 0

Views: 280

Answers (1)

Matty Cross
Matty Cross

Reputation: 62

To convert Single<E> into Observable<E>, simply the flatMap operator is what you're looking for.

On the other hand if you want to convert from Observable<E> to Single<E>, you can do so like this:

Observable<Int>.just(1)
  .flatMap { number -> Single<Int> in
    return Single<Int>.just(number)
  }
  // it's Single<Int> from now on..

Upvotes: 1

Related Questions