Wraps Apple's CoreMotion framework for reading iPhone and Apple Watch sensors: accelerometer, gyroscope, magnetometer, pedometer, and activity recognition. You get code patterns for both real-time updates and historical queries, plus the usual gotchas like needing exactly one CMMotionManager instance and remembering to add NSMotionUsageDescription to your plist. Covers the polling pattern for games, device motion fusion for attitude tracking, and the pedometer APIs for step counting and floor detection. The battery impact table is helpful since sensor update rates directly trade responsiveness for power. Solid reference if you're building fitness tracking, motion-based UI, or anything that needs to know whether the user is walking, driving, or sitting still.

skills.sh installs
3.8K
GitHub stars
1.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add dpearson2699/swift-ios-skills --skill core-motion --agent claude-code

Installs into .claude/skills of the current project.

Files

CoreMotion

Read device motion, pedometer/activity, altitude, headphone, batched-workout, and submersion sensors with Core Motion. Scope: Swift 6.3, iOS 26+.

Contents

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.

<key>NSMotionUsageDescription</key>
<string>This app uses motion data to track your activity.</string>

Authorization

Sponsors

Details

Repository
github.com/dpearson2699/swift-ios-skills
Categories
Mobile Development, Design & UI/UX
First seen
Apr 16, 2026

More from dpearson2699/swift-ios-skills

All 98
1dpearson2699 avatarnatural-languagedpearson2699/swift-ios-skillsTokenize, tag, and analyze natural language text using Apple's NaturalLanguage framework and translate between languages with the Translation framework. Use whe3.8Kskills.sh installs
2dpearson2699 avatarspeech-recognitiondpearson2699/swift-ios-skillsTranscribe speech to text using Apple's Speech framework. Use when implementing live microphone transcription with AVAudioEngine, recognizing recorded audio fil3.8Kskills.sh installs
3dpearson2699 avatardevice-integritydpearson2699/swift-ios-skillsVerify device legitimacy and app integrity using DeviceCheck (DCDevice per-device bits) and App Attest (DCAppAttestService key generation, attestation, and asse3.8Kskills.sh installs
4dpearson2699 avatarcore-nfcdpearson2699/swift-ios-skillsRead and write NFC tags using CoreNFC. Use when scanning NDEF tags, reading ISO7816/ISO15693/FeliCa/MIFARE tags, writing NDEF messages, handling NFC session lif3.8Kskills.sh installs
5dpearson2699 avatarenergykitdpearson2699/swift-ios-skillsQuery grid electricity forecasts and submit load events using EnergyKit to help users optimize home electricity usage. Use when building smart home apps, EV cha3.7Kskills.sh installs
6avdlee avatarxcode-build-fixeravdlee/xcode-build-optimization-agent-skillApply approved Xcode build optimization changes following best practices, then re-benchmark to verify improvement. Use when a developer has an approved optimiza3.7Kskills.sh installs