← ClaudeAtlas

core-motionlisted

Access Core Motion accelerometer, gyroscope, magnetometer, device-motion, pedometer, activity-recognition, altitude, headphone motion, batched high-frequency workout motion, and water-submersion/depth data. Use when reading device sensors, counting steps, detecting walking/running/driving/cycling, tracking altitude, building motion interactions, handling AirPods head tracking, or implementing watchOS dive/depth features.
thiennc-tesoglobal/ios-skills · ★ 3 · AI & Automation · score 66
Install: claude install-skill thiennc-tesoglobal/ios-skills
# CoreMotion Read device motion, pedometer/activity, altitude, headphone, batched-workout, and submersion sensors with Core Motion. Scope: Swift 6.3, iOS 26+. ## Contents - [Setup](#setup) - [CMMotionManager: Sensor Data](#cmmotionmanager-sensor-data) - [Processed Device Motion](#processed-device-motion) - [CMPedometer: Step and Distance Data](#cmpedometer-step-and-distance-data) - [CMMotionActivityManager: Activity Recognition](#cmmotionactivitymanager-activity-recognition) - [CMAltimeter: Altitude Data](#cmaltimeter-altitude-data) - [Update Intervals and Battery](#update-intervals-and-battery) - [Common Mistakes](#common-mistakes) - [Review Checklist](#review-checklist) - [References](#references) ## Setup ### Info.plist Add `NSMotionUsageDescription` to Info.plist with a user-facing string explaining why your app needs motion data. Without this key, the app crashes on first access. ```xml <key>NSMotionUsageDescription</key> <string>This app uses motion data to track your activity.</string> ``` ### Authorization Use the matching manager's `authorizationStatus()` or `authorizationStatus` property when an API exposes one (`CMPedometer`, `CMMotionActivityManager`, `CMAltimeter`, headphone motion, batched sensors, and submersion). Raw `CMMotionManager` accelerometer/gyro/device-motion streams have no explicit authorization request API; still ship the usage string and handle errors from start/update callbacks. ```swift import CoreMotion let status = CMMotionActivityMa