RxSwift: Map Operator
.map()
- 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.
----1--2-----3--4---->
map(x -> x * 2)
----2--4-----6--8---->
.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