Getting Device Motion with the CoreMotion Framework
As it does on iOS, the CoreMotion framework allows you to get access to live-updating data of the device’s motion through space. As the Apple Watch moves through space, its sensors update data and can call back into your apps. Getting access to this data is as easy as creating a CMMotionManager instance and registering for updates. Unfortunately, as of this writing, the class knows about many more data types than the watch actually supports. The CoreMotion classes on watchOS are analogous to the same classes on iOS, so they have references to data from three sensors: an accelerometer, a gyroscope, and a magnetometer. The data from these three sensors combines into an aggregate data type called ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access