Back to Skills

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.

769stars41forksUpdated 6/19/2026

Security Assessment

Safe(100/100)
Security Score100/100

About core-motion

The core-motion skill provides comprehensive access to iOS and watchOS device sensor data through Apple's CoreMotion framework. It enables developers to read raw sensor inputs from accelerometers, gyroscopes, and magnetometers, as well as processed motion data that fuses these sensors into meaningful device orientation and movement information. The skill handles step counting through pedometer APIs, recognizes user activities like walking, running, cycling, and driving, tracks altitude changes, supports AirPods head tracking for spatial audio experiences, and provides specialized features for watchOS including water submersion and depth sensing for diving applications.

Key capabilities include real-time sensor streaming at configurable update intervals, processed device motion with gravity-removed user acceleration and attitude information, fitness tracking through step and distance measurements, automatic activity classification, barometric altitude monitoring, and batched high-frequency motion data for workout analysis. The skill implements proper authorization handling with Info.plist configuration requirements and provides both callback-based and polling patterns for sensor data access. It emphasizes efficient battery usage through appropriate update interval selection and follows best practices like maintaining a single CMMotionManager instance per application.

This skill targets iOS and watchOS developers building fitness applications, navigation tools, games with motion controls, augmented reality experiences, health monitoring apps, and specialized watchOS diving applications. It's particularly valuable for developers who need to implement step counting, activity recognition, motion-based interactions, spatial audio head tracking with AirPods, or any application requiring precise device orientation and movement data. The skill is designed for Swift 6.3 and iOS 26+, providing modern API patterns and comprehensive sensor access.

FAQ

What Info.plist configuration is required to use CoreMotion?

You must add NSMotionUsageDescription to your Info.plist with a user-facing explanation of why your app needs motion data. Without this key, the app will crash on first access to motion sensors.

Should I create multiple CMMotionManager instances for different sensors?

No, you should create exactly one CMMotionManager instance per app. Multiple instances degrade sensor update rates and can cause performance issues. Use the single instance to manage all sensor types.

Which CoreMotion APIs require explicit authorization?

CMPedometer, CMMotionActivityManager, CMAltimeter, headphone motion, batched sensors, and submersion APIs require explicit authorization checks. Raw CMMotionManager accelerometer, gyroscope, and device motion streams do not have explicit authorization request APIs, but still require the NSMotionUsageDescription key.

What's the difference between accelerometer data and device motion data?

Raw accelerometer data includes gravity and measures total acceleration. Device motion fuses accelerometer, gyroscope, and magnetometer data to provide processed information including attitude (orientation), user acceleration (with gravity removed), rotation rate, and calibrated magnetic field.

How should I choose update intervals for sensor data?

Balance responsiveness with battery life. Higher frequencies (e.g., 60 Hz) are needed for games and interactive experiences, while lower frequencies (e.g., 10 Hz) are sufficient for fitness tracking. Always stop updates when not needed to conserve battery.

All Files

3 files
SKILL.md13.6 KB
View
references/motion-patterns.md12.5 KB
View
evals/evals.json4.2 KB
View

Install core-motion

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill