Agent skill · software engineering · dpearson2699
core-motion
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.
Why this skill is useful
Provides specific patterns and best practices for accessing and utilizing Core Motion data in iOS applications, which the AI may not generate reliably on its own.
What it needs
About 6k tokens when loaded. Last updated 2026-07-31. 973 stars on the source repository.
What this skill does
CoreMotion Read device motion, pedometer/activity, altitude, headphone, batched-workout, and submersion sensors with Core Motion. Scope: Swift 6.3, iOS 26+. Contents Setup CMMotionManager: Sensor Data Processed Device Motion CMPedometer: Step and Distance Data CMMotionActivityManager: Activity Recognition CMAltimeter: Altitude Data Update Intervals and Battery Common Mistakes Review Checklist 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. 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. CMMotionManager: Sensor Data Create exactly one CMMotionManager per app. Multiple instances degrade sensor update rates. Accelerometer Updates Gyroscope Updates Polling Pattern (Games) For games, start updates without a handler and poll the latest sample each frame: Processed Device Motion Device motion fuses accelerometer, gyroscope, and magnetometer into a single CMDeviceMotion object with attitude, user acceleration (gravity removed), rotation rate, and calibrated magnetic field. When giving device-motion guidance, show the runtime frame check in the snippet instead of hard-coding a corrected, magnetic-north, or true-north frame. Fall back to .xArbitraryZVertical when the preferred frame is unavailable. Attitude Reference Frames For simple tilt controls, use .xArbitraryZVertical or .xArbitraryCorrectedZVertical; they avoid magnetometer/location dependencies. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills dpearson2699/core-motion