upperBound specification
This is the engineering specification for the MotionObservable
operator: upperBound
.
Overview
upperBound
emits either the incoming value or the provided maxValue
, whichever is smaller.
Example usage
stream.upperBound(maxValue: 1)
upstream maxValue | downstream
0.50 1 | 0.50
0.75 1 | 0.75
1.00 1 | 1.00
1.25 1 | 1.00
1.50 1 | 1.00
MVP
Expose a upperBound operator API
Use _map
to implement the operator. Accept a Comparable type. Emit the result of
min(upstreamValue, maxValue)
.
class MotionObservable<Comparable> {
public func upperBound(maxValue: Comparable) -> MotionObservable<Comparable>