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
MotionObservable-Metadata · runtime MotionRuntime.whenAllAtRest
Status Interface level Implementation level Library
Proposed as of April 18, 2017 L1: App creator L4: Runtime engineering material-motion
UpdatesCurrent StatusInitiation dateCompletion date
Introduced proposal. Proposed April 18, 2017
iOS (Swift) View

MotionRuntime.whenAllAtRest specification

This is the engineering specification for the MotionRuntime’s whenAllAtRest API.


whenAllAtRest invokes a callback once all of the provided Stateful interactions have come to rest.

If the provided list of interactions is empty, then the callback is invoked exactly once and immediately.

If all of the interactions are at rest then the callback is invoked before returning.


runtime.whenAllAtRest([directlyManipulable]) {
  print("Is now at rest")


Expose a whenAllAtRest API

Accept an array of Stateful interactions and a callback function.

class MotionRuntime {
  public func whenAllAtRest(_ interactions: [Stateful], body: () -> Void)

When no interactions are provided, invoke the callback immediately

func whenAllAtRest(_ interactions: [Stateful], body: () -> Void) {
  guard interactions.count > 0 else {

If all interactions are at rest, immediately invoke the callback

When the last active interaction comes to rest, invoke the callback