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 ...
Get Developing for Apple Watch, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.