Material Motion Exploring solutions that will empower creators with the tools needed to describe and implement rich, interactive motion on any platform. Edit this page · History
$._nextOperator delayBy
Status Interface level Implementation level Library
Stable as of March 22, 2017 L2: Interaction creator L3: Stream creator material-motion
UpdatesCurrent StatusInitiation dateCompletion date
First introduced Stable March 22, 2017
platformsrctests
Android View
iOS (Swift) View View
delayBy
upstream (T)
(T) downstream

delayBy specification

This is the engineering specification for the MotionObservable operator: delayBy.

Overview

delayBy emits values from upstream after a specified delay amount.

Example usage

stream.delay(by: 0.3)

time  |  upstream  |  downstream
0     |  20        |  
0.1   |            |  
0.2   |  80        |  
0.3   |            |  20
0.4   |            |  
0.5   |            |  80

MVP

Expose a delayBy operator API

Use _nextOperator to implement the operator. Emit values after the specified delay has passed.

class MotionObservable<T> {
  public func delay(by: CGFloat) -> MotionObservable<T>

Cancel the delayed invocation on unsubscription

Unsubscription should cancel any timers that have not yet been fired.