CMDeviceMotionHandler
The type of block callback for handling device-motion data.
Declaration
typealias CMDeviceMotionHandler = (CMDeviceMotion?, (any Error)?) -> VoidMentioned in
Discussion
Blocks of type CMDeviceMotionHandler are called when there is device-motion data to process. You pass the block into startDeviceMotionUpdates(to:withHandler:) as the second argument. Blocks of this type return no value but take two arguments:
motionA CMDeviceMotion object, which encapsulates other objects and a structure representing attitude, rotation rate, gravity, and user acceleration.
errorAn error object representing an error encountered in providing device-motion data. If an error occurs, you should stop device-motion data 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.