 
   /** Informs all observers of the given state. */
   public func state(_ state: MotionState) {
+    self.state = state
     for observer in observers {
       observer.state(state)
     }

  private let _read: ScopedRead<T>
  private let _write: ScopedWrite<T>
  private let _coreAnimation: CoreAnimationChannel?
  private var observers: [MotionObserver<T>] = []
}


    let observer = MotionObserver(next: next, state: state, coreAnimation: coreAnimation)
    observers.append(observer)

    if self.state == .active {
      observer.state(.active)
    }
    observer.next(read())
    if self.state == .atRest {
      observer.state(.atRest)
    }

    return Subscription {
      if let index = self.observers.index(where: { $0 === observer }) {
