Skip to content

Latest commit

 

History

History
59 lines (48 loc) · 8.31 KB

CoreHaptics.md

File metadata and controls

59 lines (48 loc) · 8.31 KB

CoreHaptics

Symbols: 88.0% of Apple's iOS API (183 of 208, exact) · Rows: 6: 5 ✅ 1 🟡 · iOS: 13.0+

Area: Media · Apple: Core Haptics · Issues: area:media

How isim implements it

  • Adapted: a fully modelled engine (patterns, players, parameter curves, AHAP files). supportsHaptics is false, like the Simulator: the device's haptic events are shown as UIKit's feedback ring and logged; a gamepad's engine (GCController.haptics) drives the pad's rumble motors (GameController). Audio events play through isim's audio output. Rows: UIKit (Haptics & feedback).
  • Objective-C / C interface: #import <CoreHaptics/CoreHaptics.h> and -framework CoreHaptics (isim/sdk-src/Frameworks/CoreHaptics) reach the Swift overlay's classes under their Objective-C names; isim/swift/overlays/CoreHaptics/ObjC.swift has the entry points for the Swift-only types (the ID / type / key structs are NSStrings in Objective-C) and isim/frameworks/CoreHaptics/CoreHaptics.m the constants.

API

API / feature Status iOS Notes
CoreHaptics' Objective-C interface: CHHapticEngine (capabilitiesForHardware, initAndReturnError:, handlers, startAndReturnError:, createPlayerWithPattern:error:, createAdvancedPlayerWithPattern:error:, notifyWhenPlayersFinished:, playPatternFromURL: / FromData:, audio resources), CHHapticPattern (events, parameters, curves, initWithDictionary:error:, initWithContentsOfURL:error:, exportDictionaryAndReturnError:), CHHapticEvent, CHHapticEventParameter, CHHapticDynamicParameter, CHHapticParameterCurve(ControlPoint), the CHHapticPatternPlayer / CHHapticAdvancedPatternPlayer / CHHapticDeviceCapability / CHHapticParameterAttributes protocols, the CHHapticEventParameterID…, CHHapticDynamicParameterID…, CHHapticEventType…, CHHapticPatternKey… and CHHapticAudioResourceKey… constants, CHHapticErrorDomain / CHHapticErrorCode ✅ ≤17 adapted: as the Swift engine; the players are isim objects answering the protocols' selectors; the classes are not subclassable from Objective-C. Tested (tests/games-objc: capability, patterns from events, a curve and a dictionary, a refused pattern, both players with completion, the finished handler, AHAP data)
CHHapticEngine (start, stop, capabilitiesForHardware(), makePlayer / makeAdvancedPlayer, notifyWhenPlayersFinished, playPattern(from:), isMutedForAudio / isMutedForHaptics, playsHapticsOnly / playsAudioOnly, stopped / reset handlers) ✅ ≤17 adapted: supportsHaptics false (no Taptic Engine, like the Simulator), supportsAudio true; each haptic event of the device's engine is shown as UIKit's feedback ring at mid-screen and logged (CoreHaptics: transient intensity …); a gamepad's engine rumbles the pad instead; tested (HelloCoreAnimation, test_coreanimation)
CHHapticEvent, CHHapticEventParameter, CHHapticPattern (events, dynamic parameters, parameter curves, AHAP dictionaries and files, exportDictionary) ✅ ≤17 patterns are validated and timed as on iOS (a transient lasts about 22 ms); tested (HelloCoreAnimation)
Players: CHHapticPatternPlayer, CHHapticAdvancedPatternPlayer (start / stop / pause / resume / seek, loops, playbackRate, isMuted, completion), sendParameters 🟡 ≤17 adapted: each event fires at its time; hapticIntensityControl and audioVolumeControl scale the events that follow; parameter curves are accepted but not applied
Audio events: audioContinuous, audioCustom with registerAudioResource(_:options:) / unregisterAudioResource, CHHapticAudioResourceKey (useVolumeEnvelope, loopEnabled) ✅ ≤17 adapted: audioContinuous is a synthesised tone around 440 Hz (AudioPitch an octave down or up, AudioBrightness adds odd harmonics, attack and release times shape it); audioCustom plays the resource (any file AVAudioFile reads) with AudioVolume, AudioPitch (speed) and AudioPan, looped with loopEnabled, cut to the event's duration; mixed into isim's audio output; tested (HelloCoreAnimation, test_coreanimation: 440 Hz then 880 Hz on the mixed output)
CHHapticError (codes), CHHapticErrorDomain ✅ ≤17 com.apple.CoreHaptics; tested (HelloCoreAnimation)

Not yet in isim

25 symbols Apple documents for iOS that isim does not have (exact; Apple snapshot 2026-10-14). Each links to Apple's documentation.

List