_map specification
This is the engineering specification for the MotionObservable operator: _map.
Overview
_map transforms an incoming value of type T to a new value of type U. ReactiveX documentation.
Example usage
stream._map { point in
return point.x
}
upstream | downstream
{ x: 10, y: 10 } | 10
{ x: 50, y: 10 } | 50
{ x: 75, y: 50 } | 75
MVP
Expose _map API
Should delegate to _nextOperator.
class MotionObservable<T> {
public func _map<U>(transform: (T) -> U) -> MotionObservable<U> {
return _nextOperator { value, next in
next(transform(value))
}
}