This is a starter prototype for an Apple Watch air-writing app. It uses Apple Watch IMU data to approximate short handwritten input such as digits or simple symbols.
This is not camera-based OCR.
Apple Watch does not expose a public spatial camera API for reading handwriting in free space.
The prototype is based on Core Motion data:
userAccelerationrotationRategravityattitude
That makes this an IMU-based air-writing system.
- The watch samples
CMDeviceMotionat a fixed rate. - Motion-energy thresholds segment a single stroke.
- The stroke is projected into a 2D trace.
- The trace is normalized to a fixed point count.
- A lightweight local template recognizer runs on watch.
- The normalized trace is sent to iPhone with
WatchConnectivityfor a second recognition pass.
Shared/Shared models, projection, normalization, and recognition logic.WatchApp/watchOS session model, SwiftUI UI, and watch-to-phone bridge.iPhoneCompanion/iPhone-sideWCSessionreceiver and reply logic.
- Capture Apple Watch motion samples
- Segment one stroke automatically
- Render a live trace on watch
- Run a basic template recognizer for demo symbols
- Send normalized strokes to iPhone for a second pass
- This is a proof of concept, not a production recognizer.
- It is best suited to digits, short symbols, and simple gestures.
- Pure IMU integration drifts.
- Continuous words, Chinese characters, and arbitrary orientations will need a trained model.
- Long high-frequency capture usually needs a workout or runtime strategy.
- Start with digits and a small command alphabet.
- Collect your own labeled dataset.
- Feed time-series features into the model, not just projected points.
- Try 1D CNN, BiLSTM, or Transformer encoder models.
- Keep watch as the sensor node and iPhone as the inference node first.
- Move to on-watch Core ML only after accuracy is stable.
- Create a new
watchOS AppwithiOS companionon macOS. - Add
Sharedfiles to both targets. - Add
WatchAppfiles to the watch target. - Add
iPhoneCompanionfiles to the iPhone target. - Add
NSMotionUsageDescriptiontoInfo.plist. - Enable
WatchConnectivity. - If you need longer capture sessions, evaluate
HealthKitworkout sessions or other runtime options.
Example Info.plist entry:
<key>NSMotionUsageDescription</key>
<string>Used to capture wrist motion for air-writing recognition.</string>- Apple documents watchOS support for high-frequency accelerometer and device motion batches in workout scenarios.
CMMotionManagerexposesstartDeviceMotionUpdates(...).WatchConnectivitysendMessage(_:replyHandler:errorHandler:)is appropriate for foreground reachable communication.- Apple also documents multidevice workout communication, which matches a watch + iPhone architecture.
- Apple Developer, watchOS updates: https://developer.apple.com/documentation/updates/watchos
- Apple Developer, CMMotionManager: https://developer.apple.com/documentation/coremotion/cmmotionmanager
- Apple Developer, startDeviceMotionUpdates(using:to:withHandler:): https://developer.apple.com/documentation/coremotion/cmmotionmanager/startdevicemotionupdates%28using%3Ato%3Awithhandler%3A%29
- Apple Developer, CMBatchedSensorManager: https://developer.apple.com/documentation/coremotion/cmbatchedsensormanager
- Apple Developer, WCSession.sendMessage(_:replyHandler:errorHandler:): https://developer.apple.com/documentation/watchconnectivity/wcsession/sendmessage%28_%3Areplyhandler%3Aerrorhandler%3A%29
- Apple Developer, Building a multidevice workout app: https://developer.apple.com/documentation/HealthKit/building-a-multidevice-workout-app
- Apple Developer, Creating independent watchOS apps: https://developer.apple.com/documentation/watchos-apps/creating-independent-watchos-apps