Step into Swift logo

What is the FlatMap Operator in RxSwift?

FlatMap Operator

RxSwift: FlatMap Operator

.flatMap { }

  • Projects and transforms the observable values of an Observable via a supplied predicate and then flattens them down to a single observable.
  • Useful to filter out nil.
  • Only emits values of an observable when then observable completes.
-----YY---------------YY---YY--->

flatMap { YY -> XX}

-----XX---------------XX---XX--->

< All Posts