Step into Swift logo

What is the Map Operator in RxSwift?

Map Operator

RxSwift: Map Operator


  • Applies a supplied function to each emitted element.
  • Returns an Observable that emits the result after the function has been applied.
  • Transforms the elements emitted by an Observable by applying a function to each element.
  • Works like Swifts standard map except it operates on observables.

map(x -> x * 2)

.map { response in return response.url }
.map({ (response: urls) -> [Url] in return response.urls })

// or even better...

.map { $0.url }
.map { $0.urls }

< All Posts