Inline connection specification
This is the engineering specification for an inline MotionObservable connection implementation.
MVP
Return a motion observable
return MotionObservable { observer in
// Connect to a source
return {
// Disconnect from the source
}
}
Instantiate the source inline
return MotionObservable { observer in
let someSource = Source()
...
}
Start the source on connection
This should be done after configuring the source and before returning the disconnect method.
return MotionObservable { observer in
...
someSource.start()
return {
...
}
}
Stop the source on disconnection
This may require some amount of teardown to occur.
return MotionObservable { observer in
...
return {
someSource.stop()
}
}