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
ReactiveProperty createProperty feature specification
Status Interface level Implementation level Library
Stable as of February 19, 2017 L2: Interaction creator L4: Runtime engineering material-motion
platformsrctests
Android View View
JavaScript View View
iOS (Swift) View View

createProperty feature specification

This is the engineering specification for the createProperty API.

Overview

createProperty(withInitialValue:) creates an anonymous ReactiveProperty with a given initial value.

For languages that don’t allow top-level functions, ReactiveProperty.of() is the preferred API signature.

let someProperty = createProperty(withInitialValue: 20)
ReactiveProperty<Float> property = ReactiveProperty.of(100f);

MVP

Expose a createProperty API

It should be genericized on type T.

public func createProperty<T>(withInitialValue initialValue: T) -> ReactiveProperty<T>
public static <T> ReactiveProperty<T> of(T initialValue)

Return a ReactiveProperty instance

func createProperty<T>(withInitialValue value: T) -> ReactiveProperty<T> {
  return ReactiveProperty(withInitialValue: value)
}
public static <T> ReactiveProperty<T> of(T initialValue) {
  return new ValueReactiveProperty<>(initialValue);
}