I'm getting the phone absolute rotation (minus the z-axis) using the phone accelerometer with something like this:
motionManager.startAccelerometerUpdates()
...
if let data = motionManager.accelerometerData {
let x = data.acceleration.x
let y = data.acceleration.y
}
I know it can also be obtained using motionManager.startGyroUpdates()
as stated in this answer:
Obtain absolute rotation using CMDeviceMotion?
I'd like to know what is the differences between using the accelerometer and the gyroscope for this goal. Is it one faster, more precise, less resource hungry than the other?
The accelerometer measures rate of change for linear acceleration. Mostly used for translation in x, y, and z vectors.
The gyroscope is for rotational rate of change in x, y, z vectors.
In your case, if you want the most precise data for rotation, you really should be using the gyroscope and associated data.