CMAccelerometerHandler
The type of block callback for handling accelerometer data.
Declaration
typealias CMAccelerometerHandler = (CMAccelerometerData?, (any Error)?) -> VoidDiscussion
Blocks of type CMAccelerometerHandler are called when there is accelerometer data to process. You pass the block into startAccelerometerUpdates(to:withHandler:) as the second argument. Blocks of this type return no value but take two arguments:
accelerometerDataAn object that encapsulates a CMAcceleration structure with fields holding acceleration values for the three axes of movement.
errorAn error object representing an error encountered in providing accelerometer updates. If an error occurs, you should stop accelerometer updates and inform the user of the problem. If there is no error, this argument is
nil. Core Motion errors are of the CMErrorDomain domain and the CMError type.