[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E6BH1RS7AVZ9F5VC4EMAAW":3,"skill-same:01M6E6BH1RS7AVZ9F5VC4EMAAW":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":33,"linkOnly":34,"markdownContent":35,"markdownBody":36,"frontMatter":37,"refName":40,"commitSha":41,"skillDirectory":42,"forksCount":43,"repositoryHtmlUrl":44,"repositoryHomepageUrl":45,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":47,"updatedAt":48,"install":49,"resources":62},"01M6E6BH1RS7AVZ9F5VC4EMAAW","axiom-haptics",null,"Use when implementing haptic feedback, Core Haptics patterns, audio-haptic synchronization, or debugging haptic issues - covers UIFeedbackGenerator, CHHapticEngine, AHAP patterns, and Apple's Causality-Harmony-Utility design principles from WWDC 2021","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-haptics\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32],"axiom haptics","design","debugging","core","issues","Audio","feedback","synchronization","use","design principles","patterns","apple","harmony","utility","2026-11-10 10:12:30",false,"---\nname: axiom-haptics\ndescription: Use when implementing haptic feedback, Core Haptics patterns, audio-haptic synchronization, or debugging haptic issues - covers UIFeedbackGenerator, CHHapticEngine, AHAP patterns, and Apple's Causality-Harmony-Utility design principles from WWDC 2021\nlicense: MIT\nmetadata:\n  version: \"1.0.0\"\n---\n\n# Haptics & Audio Feedback\n\nComprehensive guide to implementing haptic feedback on iOS. Every Apple Design Award winner uses excellent haptic feedback - Camera, Maps, Weather all use haptics masterfully to create delightful, responsive experiences.\n\n## Overview\n\nHaptic feedback provides tactile confirmation of user actions and system events. When designed thoughtfully using the Causality-Harmony-Utility framework, axiom-haptics transform interfaces from functional to delightful.\n\nThis skill covers both simple haptics (`UIFeedbackGenerator`) and advanced custom patterns (`Core Haptics`), with real-world examples and audio-haptic synchronization techniques.\n\n## When to Use This Skill\n\n- Adding haptic feedback to user interactions\n- Choosing between UIFeedbackGenerator and Core Haptics\n- Designing audio-haptic experiences that feel unified\n- Creating custom haptic patterns with AHAP files\n- Synchronizing haptics with animations and audio\n- Debugging haptic issues (simulator vs device)\n- Optimizing haptic performance and battery impact\n\n## System Requirements\n\n- **iOS 10+** for UIFeedbackGenerator\n- **iOS 13+** for Core Haptics (CHHapticEngine)\n- **iPhone 8+** for Core Haptics hardware support\n- **Physical device required** - haptics cannot be felt in Simulator\n\n---\n\n## Part 1: Design Principles (WWDC 2021\u002F10278)\n\nApple's audio and haptic design teams established three core principles for multimodal feedback:\n\n### Causality - Make it obvious what caused the feedback\n\n**Problem**: User can't tell what triggered the haptic\n**Solution**: Haptic timing must match the visual\u002Finteraction moment\n\n**Example from WWDC**:\n- ✅ Ball hits wall → haptic fires at collision moment\n- ❌ Ball hits wall → haptic fires 100ms later (confusing)\n\n**Code pattern**:\n```swift\n\u002F\u002F ✅ Immediate feedback on touch\n@objc func buttonTapped() {\n    let generator = UIImpactFeedbackGenerator(style: .medium)\n    generator.impactOccurred()  \u002F\u002F Fire immediately\n    performAction()\n}\n\n\u002F\u002F ❌ Delayed feedback loses causality\n@objc func buttonTapped() {\n    performAction()\n    DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {\n        let generator = UIImpactFeedbackGenerator(style: .medium)\n        generator.impactOccurred()  \u002F\u002F Too late!\n    }\n}\n```\n\n### Harmony - Senses work best when coherent\n\n**Problem**: Visual, audio, and haptic don't match\n**Solution**: All three senses should feel like a unified experience\n\n**Example from WWDC**:\n- Small ball → light haptic + high-pitched sound\n- Large ball → heavy haptic + low-pitched sound\n- Shield transformation → continuous haptic + progressive audio\n\n**Key insight**: A large object should **feel** heavy, **sound** low and resonant, and **look** substantial. All three senses reinforce the same experience.\n\n### Utility - Provide clear value\n\n**Problem**: Haptics used everywhere \"just because we can\"\n**Solution**: Reserve haptics for significant moments that benefit the user\n\n**When to use haptics**:\n- ✅ Confirming an important action (payment completed)\n- ✅ Alerting to critical events (low battery)\n- ✅ Providing continuous feedback (scrubbing slider)\n- ✅ Enhancing delight (app launch flourish)\n\n**When NOT to use haptics**:\n- ❌ Every single tap (overwhelming)\n- ❌ Scrolling through long lists (battery drain)\n- ❌ Background events user can't see (confusing)\n- ❌ Decorative animations (no value)\n\n---\n\n## Part 2: UIFeedbackGenerator (Simple Haptics)\n\nFor most apps, `UIFeedbackGenerator` provides 3 simple haptic types without custom patterns.\n\n### UIImpactFeedbackGenerator\n\nPhysical collision or impact sensation.\n\n**Styles** (ordered light → heavy):\n- `.light` - Small, delicate tap\n- `.medium` - Standard tap (most common)\n- `.heavy` - Strong, solid impact\n- `.rigid` - Firm, precise tap\n- `.soft` - Gentle, cushioned tap\n\n**Usage pattern**:\n```swift\nclass MyViewController: UIViewController {\n    let impactGenerator = UIImpactFeedbackGenerator(style: .medium)\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \u002F\u002F Prepare reduces latency for next impact\n        impactGenerator.prepare()\n    }\n\n    @objc func userDidTap() {\n        impactGenerator.impactOccurred()\n    }\n}\n```\n\n**Intensity variation** (iOS 13+):\n```swift\n\u002F\u002F intensity: 0.0 (lightest) to 1.0 (strongest)\nimpactGenerator.impactOccurred(intensity: 0.5)\n```\n\n**Common use cases**:\n- Button taps (`.medium`)\n- Toggle switches (`.light`)\n- Deleting items (`.heavy`)\n- Confirming selections (`.rigid`)\n\n### UISelectionFeedbackGenerator\n\nDiscrete selection changes (picker wheels, segmented controls).\n\n**Usage**:\n```swift\nclass PickerViewController: UIViewController {\n    let selectionGenerator = UISelectionFeedbackGenerator()\n\n    func pickerView(_ picker: UIPickerView, didSelectRow row: Int,\n                    inComponent component: Int) {\n        selectionGenerator.selectionChanged()\n    }\n}\n```\n\n**Feels like**: Clicking a physical wheel with detents\n\n**Common use cases**:\n- Picker wheels\n- Segmented controls\n- Page indicators\n- Step-through interfaces\n\n### UINotificationFeedbackGenerator\n\nSystem-level success\u002Fwarning\u002Ferror feedback.\n\n**Types**:\n- `.success` - Task completed successfully\n- `.warning` - Attention needed, but not critical\n- `.error` - Critical error occurred\n\n**Usage**:\n```swift\nlet notificationGenerator = UINotificationFeedbackGenerator()\n\nfunc submitForm() {\n    \u002F\u002F Validate form\n    if isValid {\n        notificationGenerator.notificationOccurred(.success)\n        saveData()\n    } else {\n        notificationGenerator.notificationOccurred(.error)\n        showValidationErrors()\n    }\n}\n```\n\n**Best practice**: Match haptic type to user outcome\n- ✅ Payment succeeds → `.success`\n- ✅ Form validation fails → `.error`\n- ✅ Approaching storage limit → `.warning`\n\n### Performance: prepare()\n\nCall `prepare()` before the haptic to reduce latency:\n\n```swift\n\u002F\u002F ✅ Good - prepare before user action\n@IBAction func buttonTouchDown(_ sender: UIButton) {\n    impactGenerator.prepare()  \u002F\u002F User's finger is down\n}\n\n@IBAction func buttonTouchUpInside(_ sender: UIButton) {\n    impactGenerator.impactOccurred()  \u002F\u002F Immediate haptic\n}\n\n\u002F\u002F ❌ Bad - unprepared haptic may lag\n@IBAction func buttonTapped(_ sender: UIButton) {\n    let generator = UIImpactFeedbackGenerator()\n    generator.impactOccurred()  \u002F\u002F May have 10-20ms delay\n}\n```\n\n**Prepare timing**: System keeps engine ready for ~1 second after `prepare()`.\n\n---\n\n## Part 3: Core Haptics (Custom Haptics)\n\nFor apps needing custom patterns, `Core Haptics` provides full control over haptic waveforms.\n\n### Four Fundamental Elements\n\n1. **Engine** (`CHHapticEngine`) - Link to the phone's actuator\n2. **Player** (`CHHapticPatternPlayer`) - Playback control\n3. **Pattern** (`CHHapticPattern`) - Collection of events over time\n4. **Events** (`CHHapticEvent`) - Building blocks specifying the experience\n\n### CHHapticEngine Lifecycle\n\n```swift\nimport CoreHaptics\n\nclass HapticManager {\n    var engine: CHHapticEngine?\n\n    func initializeHaptics() {\n        \u002F\u002F Check device support\n        guard CHHapticEngine.capabilitiesForHardware().supportsHaptics else {\n            print(\"Device doesn't support haptics\")\n            return\n        }\n\n        do {\n            \u002F\u002F Create engine\n            engine = try CHHapticEngine()\n\n            \u002F\u002F Handle interruptions (calls, Siri, etc.)\n            engine?.stoppedHandler = { reason in\n                print(\"Engine stopped: \\(reason)\")\n                self.restartEngine()\n            }\n\n            \u002F\u002F Handle reset (audio session changes)\n            engine?.resetHandler = {\n                print(\"Engine reset\")\n                self.restartEngine()\n            }\n\n            \u002F\u002F Start engine\n            try engine?.start()\n\n        } catch {\n            print(\"Failed to create haptic engine: \\(error)\")\n        }\n    }\n\n    func restartEngine() {\n        do {\n            try engine?.start()\n        } catch {\n            print(\"Failed to restart engine: \\(error)\")\n        }\n    }\n}\n```\n\n**Critical**: Always set `stoppedHandler` and `resetHandler` to handle system interruptions.\n\n### CHHapticEvent Types\n\n#### Transient Events\n\nShort, discrete feedback (like a tap).\n\n```swift\nlet intensity = CHHapticEventParameter(\n    parameterID: .hapticIntensity,\n    value: 1.0  \u002F\u002F 0.0 to 1.0\n)\n\nlet sharpness = CHHapticEventParameter(\n    parameterID: .hapticSharpness,\n    value: 0.5  \u002F\u002F 0.0 (dull) to 1.0 (sharp)\n)\n\nlet event = CHHapticEvent(\n    eventType: .hapticTransient,\n    parameters: [intensity, sharpness],\n    relativeTime: 0.0  \u002F\u002F Seconds from pattern start\n)\n```\n\n**Parameters**:\n- `hapticIntensity`: Strength (0.0 = barely felt, 1.0 = maximum)\n- `hapticSharpness`: Character (0.0 = dull thud, 1.0 = crisp snap)\n\n#### Continuous Events\n\nSustained feedback over time (like a vibration motor).\n\n```swift\nlet intensity = CHHapticEventParameter(\n    parameterID: .hapticIntensity,\n    value: 0.8\n)\n\nlet sharpness = CHHapticEventParameter(\n    parameterID: .hapticSharpness,\n    value: 0.3\n)\n\nlet event = CHHapticEvent(\n    eventType: .hapticContinuous,\n    parameters: [intensity, sharpness],\n    relativeTime: 0.0,\n    duration: 2.0  \u002F\u002F Seconds\n)\n```\n\n**Use cases**:\n- Rolling texture as object moves\n- Motor running\n- Charging progress\n- Long press feedback\n\n### Creating and Playing Patterns\n\n```swift\nfunc playCustomPattern() {\n    \u002F\u002F Create events\n    let tap1 = CHHapticEvent(\n        eventType: .hapticTransient,\n        parameters: [\n            CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.5),\n            CHHapticEventParameter(parameterID: .hapticSharpness, value: 0.5)\n        ],\n        relativeTime: 0.0\n    )\n\n    let tap2 = CHHapticEvent(\n        eventType: .hapticTransient,\n        parameters: [\n            CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.7),\n            CHHapticEventParameter(parameterID: .hapticSharpness, value: 0.7)\n        ],\n        relativeTime: 0.3\n    )\n\n    let tap3 = CHHapticEvent(\n        eventType: .hapticTransient,\n        parameters: [\n            CHHapticEventParameter(parameterID: .hapticIntensity, value: 1.0),\n            CHHapticEventParameter(parameterID: .hapticSharpness, value: 1.0)\n        ],\n        relativeTime: 0.6\n    )\n\n    do {\n        \u002F\u002F Create pattern from events\n        let pattern = try CHHapticPattern(\n            events: [tap1, tap2, tap3],\n            parameters: []\n        )\n\n        \u002F\u002F Create player\n        let player = try engine?.makePlayer(with: pattern)\n\n        \u002F\u002F Play\n        try player?.start(atTime: CHHapticTimeImmediate)\n\n    } catch {\n        print(\"Failed to play pattern: \\(error)\")\n    }\n}\n```\n\n### CHHapticAdvancedPatternPlayer - Looping\n\nFor continuous feedback (rolling textures, motors), use advanced player:\n\n```swift\nfunc startRollingTexture() {\n    let event = CHHapticEvent(\n        eventType: .hapticContinuous,\n        parameters: [\n            CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.4),\n            CHHapticEventParameter(parameterID: .hapticSharpness, value: 0.2)\n        ],\n        relativeTime: 0.0,\n        duration: 0.5\n    )\n\n    do {\n        let pattern = try CHHapticPattern(events: [event], parameters: [])\n\n        \u002F\u002F Use advanced player for looping\n        let player = try engine?.makeAdvancedPlayer(with: pattern)\n\n        \u002F\u002F Enable looping\n        try player?.loopEnabled = true\n\n        \u002F\u002F Start\n        try player?.start(atTime: CHHapticTimeImmediate)\n\n        \u002F\u002F Update intensity dynamically based on ball speed\n        updateTextureIntensity(player: player)\n\n    } catch {\n        print(\"Failed to start texture: \\(error)\")\n    }\n}\n\nfunc updateTextureIntensity(player: CHHapticAdvancedPatternPlayer?) {\n    let newIntensity = calculateIntensityFromBallSpeed()\n\n    let intensityParam = CHHapticDynamicParameter(\n        parameterID: .hapticIntensityControl,\n        value: newIntensity,\n        relativeTime: 0\n    )\n\n    try? player?.sendParameters([intensityParam], atTime: CHHapticTimeImmediate)\n}\n```\n\n**Key difference**: `CHHapticPatternPlayer` plays once, `CHHapticAdvancedPatternPlayer` supports looping and dynamic parameter updates.\n\n---\n\n## Part 4: AHAP Files (Apple Haptic Audio Pattern)\n\nAHAP (Apple Haptic Audio Pattern) files are JSON files combining haptic events and audio.\n\n### Basic AHAP Structure\n\n```json\n{\n  \"Version\": 1.0,\n  \"Metadata\": {\n    \"Project\": \"My App\",\n    \"Created\": \"2024-01-15\"\n  },\n  \"Pattern\": [\n    {\n      \"Event\": {\n        \"Time\": 0.0,\n        \"EventType\": \"HapticTransient\",\n        \"EventParameters\": [\n          {\n            \"ParameterID\": \"HapticIntensity\",\n            \"ParameterValue\": 1.0\n          },\n          {\n            \"ParameterID\": \"HapticSharpness\",\n            \"ParameterValue\": 0.5\n          }\n        ]\n      }\n    }\n  ]\n}\n```\n\n### Adding Audio to AHAP\n\n```json\n{\n  \"Version\": 1.0,\n  \"Pattern\": [\n    {\n      \"Event\": {\n        \"Time\": 0.0,\n        \"EventType\": \"AudioCustom\",\n        \"EventParameters\": [\n          {\n            \"ParameterID\": \"AudioVolume\",\n            \"ParameterValue\": 0.8\n          }\n        ],\n        \"EventWaveformPath\": \"ShieldA.wav\"\n      }\n    },\n    {\n      \"Event\": {\n        \"Time\": 0.0,\n        \"EventType\": \"HapticContinuous\",\n        \"EventDuration\": 0.5,\n        \"EventParameters\": [\n          {\n            \"ParameterID\": \"HapticIntensity\",\n            \"ParameterValue\": 0.6\n          }\n        ]\n      }\n    }\n  ]\n}\n```\n\n### Loading AHAP Files\n\n```swift\nfunc loadAHAPPattern(named name: String) -> CHHapticPattern? {\n    guard let url = Bundle.main.url(forResource: name, withExtension: \"ahap\") else {\n        print(\"AHAP file not found\")\n        return nil\n    }\n\n    do {\n        return try CHHapticPattern(contentsOf: url)\n    } catch {\n        print(\"Failed to load AHAP: \\(error)\")\n        return nil\n    }\n}\n\n\u002F\u002F Usage\nif let pattern = loadAHAPPattern(named: \"ShieldTransient\") {\n    let player = try? engine?.makePlayer(with: pattern)\n    try? player?.start(atTime: CHHapticTimeImmediate)\n}\n```\n\n### Design Workflow (WWDC Example)\n\n1. **Create visual animation** (e.g., shield transformation, 500ms)\n2. **Design audio** (convey energy gain and robustness)\n3. **Design haptic** (feel the transformation)\n4. **Test harmony** - Do all three senses work together?\n5. **Iterate** - Swap AHAP assets until coherent\n6. **Implement** - Update code to use final assets\n\n**Example iteration**: Shield initially used 3 transient pulses (haptic) + progressive continuous sound (audio) → no harmony. Solution: Switch to continuous haptic + ShieldA.wav audio → unified experience.\n\n---\n\n## Part 5: Audio-Haptic Synchronization\n\n### Matching Animation Timing\n\n```swift\nclass ViewController: UIViewController {\n    let animationDuration: TimeInterval = 0.5\n\n    func performShieldTransformation() {\n        \u002F\u002F Start haptic\u002Faudio simultaneously with animation\n        playShieldPattern()\n\n        UIView.animate(withDuration: animationDuration) {\n            self.shieldView.transform = CGAffineTransform(scaleX: 1.2, y: 1.2)\n            self.shieldView.alpha = 0.8\n        }\n    }\n\n    func playShieldPattern() {\n        if let pattern = loadAHAPPattern(named: \"ShieldContinuous\") {\n            let player = try? engine?.makePlayer(with: pattern)\n            try? player?.start(atTime: CHHapticTimeImmediate)\n        }\n    }\n}\n```\n\n**Critical**: Fire haptic at the exact moment the visual change occurs, not before or after.\n\n### Coordinating with Audio\n\n```swift\nimport AVFoundation\n\nclass AudioHapticCoordinator {\n    let audioPlayer: AVAudioPlayer\n    let hapticEngine: CHHapticEngine\n\n    func playCoordinatedExperience() {\n        \u002F\u002F Prepare both systems\n        hapticEngine.notifyWhenPlayersFinished { _ in\n            return .stopEngine\n        }\n\n        \u002F\u002F Start at exact same moment\n        let startTime = CACurrentMediaTime() + 0.05  \u002F\u002F Small delay for sync\n\n        \u002F\u002F Start audio\n        audioPlayer.play(atTime: startTime)\n\n        \u002F\u002F Start haptic\n        if let pattern = loadAHAPPattern(named: \"CoordinatedPattern\") {\n            let player = try? hapticEngine.makePlayer(with: pattern)\n            try? player?.start(atTime: CHHapticTimeImmediate)\n        }\n    }\n}\n```\n\n---\n\n## Part 6: Common Patterns\n\n### Button Tap\n\n```swift\nclass HapticButton: UIButton {\n    let impactGenerator = UIImpactFeedbackGenerator(style: .medium)\n\n    override func touchesBegan(_ touches: Set\u003CUITouch>, with event: UIEvent?) {\n        super.touchesBegan(touches, with: event)\n        impactGenerator.prepare()\n    }\n\n    override func touchesEnded(_ touches: Set\u003CUITouch>, with event: UIEvent?) {\n        super.touchesEnded(touches, with: event)\n        impactGenerator.impactOccurred()\n    }\n}\n```\n\n### Slider Scrubbing\n\n```swift\nclass HapticSlider: UISlider {\n    let selectionGenerator = UISelectionFeedbackGenerator()\n    var lastValue: Float = 0\n\n    @objc func valueChanged() {\n        let threshold: Float = 0.1\n\n        if abs(value - lastValue) >= threshold {\n            selectionGenerator.selectionChanged()\n            lastValue = value\n        }\n    }\n}\n```\n\n### Pull-to-Refresh\n\n```swift\nclass PullToRefreshController: UIViewController {\n    let impactGenerator = UIImpactFeedbackGenerator(style: .medium)\n    var isRefreshing = false\n\n    func scrollViewDidScroll(_ scrollView: UIScrollView) {\n        let threshold: CGFloat = -100\n        let offset = scrollView.contentOffset.y\n\n        if offset \u003C= threshold && !isRefreshing {\n            impactGenerator.impactOccurred()\n            isRefreshing = true\n            beginRefresh()\n        }\n    }\n}\n```\n\n### Success\u002FError Feedback\n\n```swift\nfunc handleServerResponse(_ result: Result\u003CData, Error>) {\n    let notificationGenerator = UINotificationFeedbackGenerator()\n\n    switch result {\n    case .success:\n        notificationGenerator.notificationOccurred(.success)\n        showSuccessMessage()\n    case .failure:\n        notificationGenerator.notificationOccurred(.error)\n        showErrorAlert()\n    }\n}\n```\n\n---\n\n## Part 7: Testing & Debugging\n\n### Simulator Limitations\n\n**Haptics DO NOT work in Simulator**. You will see:\n- No haptic feedback\n- No warnings or errors\n- Code runs normally\n\n**Solution**: Always test on physical device (iPhone 8 or newer).\n\n### Device Testing Checklist\n\n- [ ] Test with Haptics disabled in Settings → Sounds & Haptics\n- [ ] Test with Low Power Mode enabled\n- [ ] Test during incoming call (engine may stop)\n- [ ] Test with audio playing in background\n- [ ] Test with different intensity\u002Fsharpness values\n- [ ] Verify battery impact (Instruments Energy Log)\n\n### Debug Logging\n\n```swift\nfunc playHaptic() {\n    #if DEBUG\n    print(\"? Playing haptic - Engine running: \\(engine?.currentTime ?? -1)\")\n    #endif\n\n    do {\n        let player = try engine?.makePlayer(with: pattern)\n        try player?.start(atTime: CHHapticTimeImmediate)\n\n        #if DEBUG\n        print(\"✅ Haptic started successfully\")\n        #endif\n    } catch {\n        #if DEBUG\n        print(\"❌ Haptic failed: \\(error.localizedDescription)\")\n        #endif\n    }\n}\n```\n\n---\n\n## Troubleshooting\n\n### Engine fails to start\n\n**Symptom**: `CHHapticEngine.start()` throws error\n\n**Causes**:\n1. Device doesn't support Core Haptics (\u003C iPhone 8)\n2. Haptics disabled in Settings\n3. Low Power Mode enabled\n\n**Solution**:\n```swift\nfunc safelyStartEngine() {\n    guard CHHapticEngine.capabilitiesForHardware().supportsHaptics else {\n        print(\"Device doesn't support haptics\")\n        return\n    }\n\n    do {\n        try engine?.start()\n    } catch {\n        print(\"Engine start failed: \\(error)\")\n        \u002F\u002F Fall back to UIFeedbackGenerator\n        useFallbackHaptics()\n    }\n}\n```\n\n### Haptics not felt\n\n**Symptom**: Code runs but no haptic felt on device\n\n**Debug steps**:\n1. Check Settings → Sounds & Haptics → System Haptics is ON\n2. Check Low Power Mode is OFF\n3. Verify device is iPhone 8 or newer\n4. Check intensity > 0.3 (values below may be too subtle)\n5. Test with UIFeedbackGenerator to isolate Core Haptics vs system issue\n\n### Audio out of sync with haptics\n\n**Symptom**: Audio plays but haptic delayed or vice versa\n\n**Causes**:\n1. Not calling `prepare()` before haptic\n2. Audio\u002Fhaptic started at different times\n3. Heavy main thread work blocking playback\n\n**Solution**:\n```swift\n\u002F\u002F ✅ Synchronized start\nfunc playCoordinated() {\n    impactGenerator.prepare()  \u002F\u002F Reduce latency\n\n    \u002F\u002F Start both simultaneously\n    audioPlayer.play()\n    impactGenerator.impactOccurred()\n}\n```\n\n### Audio file errors with AHAP\n\n**Symptom**: AHAP pattern fails to load or play\n\n**Cause**: Audio file > 4.2 MB or > 23 seconds\n\n**Solution**: Keep audio files small and short. Use compressed formats (AAC) and trim to essential duration.\n\n---\n\n## Resources\n\n**WWDC**: 2021-10278, 2019-520, 2019-223\n\n**Docs**: \u002Fcorehaptics, \u002Fcorehaptics\u002Fchhapticengine\n\n**Skills**: axiom-swiftui-animation-ref, axiom-ui-testing, axiom-accessibility-diag\n\n","# Haptics & Audio Feedback\n\nComprehensive guide to implementing haptic feedback on iOS. Every Apple Design Award winner uses excellent haptic feedback - Camera, Maps, Weather all use haptics masterfully to create delightful, responsive experiences.\n\n## Overview\n\nHaptic feedback provides tactile confirmation of user actions and system events. When designed thoughtfully using the Causality-Harmony-Utility framework, axiom-haptics transform interfaces from functional to delightful.\n\nThis skill covers both simple haptics (`UIFeedbackGenerator`) and advanced custom patterns (`Core Haptics`), with real-world examples and audio-haptic synchronization techniques.\n\n## When to Use This Skill\n\n- Adding haptic feedback to user interactions\n- Choosing between UIFeedbackGenerator and Core Haptics\n- Designing audio-haptic experiences that feel unified\n- Creating custom haptic patterns with AHAP files\n- Synchronizing haptics with animations and audio\n- Debugging haptic issues (simulator vs device)\n- Optimizing haptic performance and battery impact\n\n## System Requirements\n\n- **iOS 10+** for UIFeedbackGenerator\n- **iOS 13+** for Core Haptics (CHHapticEngine)\n- **iPhone 8+** for Core Haptics hardware support\n- **Physical device required** - haptics cannot be felt in Simulator\n\n---\n\n## Part 1: Design Principles (WWDC 2021\u002F10278)\n\nApple's audio and haptic design teams established three core principles for multimodal feedback:\n\n### Causality - Make it obvious what caused the feedback\n\n**Problem**: User can't tell what triggered the haptic\n**Solution**: Haptic timing must match the visual\u002Finteraction moment\n\n**Example from WWDC**:\n- ✅ Ball hits wall → haptic fires at collision moment\n- ❌ Ball hits wall → haptic fires 100ms later (confusing)\n\n**Code pattern**:\n```swift\n\u002F\u002F ✅ Immediate feedback on touch\n@objc func buttonTapped() {\n    let generator = UIImpactFeedbackGenerator(style: .medium)\n    generator.impactOccurred()  \u002F\u002F Fire immediately\n    performAction()\n}\n\n\u002F\u002F ❌ Delayed feedback loses causality\n@objc func buttonTapped() {\n    performAction()\n    DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {\n        let generator = UIImpactFeedbackGenerator(style: .medium)\n        generator.impactOccurred()  \u002F\u002F Too late!\n    }\n}\n```\n\n### Harmony - Senses work best when coherent\n\n**Problem**: Visual, audio, and haptic don't match\n**Solution**: All three senses should feel like a unified experience\n\n**Example from WWDC**:\n- Small ball → light haptic + high-pitched sound\n- Large ball → heavy haptic + low-pitched sound\n- Shield transformation → continuous haptic + progressive audio\n\n**Key insight**: A large object should **feel** heavy, **sound** low and resonant, and **look** substantial. All three senses reinforce the same experience.\n\n### Utility - Provide clear value\n\n**Problem**: Haptics used everywhere \"just because we can\"\n**Solution**: Reserve haptics for significant moments that benefit the user\n\n**When to use haptics**:\n- ✅ Confirming an important action (payment completed)\n- ✅ Alerting to critical events (low battery)\n- ✅ Providing continuous feedback (scrubbing slider)\n- ✅ Enhancing delight (app launch flourish)\n\n**When NOT to use haptics**:\n- ❌ Every single tap (overwhelming)\n- ❌ Scrolling through long lists (battery drain)\n- ❌ Background events user can't see (confusing)\n- ❌ Decorative animations (no value)\n\n---\n\n## Part 2: UIFeedbackGenerator (Simple Haptics)\n\nFor most apps, `UIFeedbackGenerator` provides 3 simple haptic types without custom patterns.\n\n### UIImpactFeedbackGenerator\n\nPhysical collision or impact sensation.\n\n**Styles** (ordered light → heavy):\n- `.light` - Small, delicate tap\n- `.medium` - Standard tap (most common)\n- `.heavy` - Strong, solid impact\n- `.rigid` - Firm, precise tap\n- `.soft` - Gentle, cushioned tap\n\n**Usage pattern**:\n```swift\nclass MyViewController: UIViewController {\n    let impactGenerator = UIImpactFeedbackGenerator(style: .medium)\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \u002F\u002F Prepare reduces latency for next impact\n        impactGenerator.prepare()\n    }\n\n    @objc func userDidTap() {\n        impactGenerator.impactOccurred()\n    }\n}\n```\n\n**Intensity variation** (iOS 13+):\n```swift\n\u002F\u002F intensity: 0.0 (lightest) to 1.0 (strongest)\nimpactGenerator.impactOccurred(intensity: 0.5)\n```\n\n**Common use cases**:\n- Button taps (`.medium`)\n- Toggle switches (`.light`)\n- Deleting items (`.heavy`)\n- Confirming selections (`.rigid`)\n\n### UISelectionFeedbackGenerator\n\nDiscrete selection changes (picker wheels, segmented controls).\n\n**Usage**:\n```swift\nclass PickerViewController: UIViewController {\n    let selectionGenerator = UISelectionFeedbackGenerator()\n\n    func pickerView(_ picker: UIPickerView, didSelectRow row: Int,\n                    inComponent component: Int) {\n        selectionGenerator.selectionChanged()\n    }\n}\n```\n\n**Feels like**: Clicking a physical wheel with detents\n\n**Common use cases**:\n- Picker wheels\n- Segmented controls\n- Page indicators\n- Step-through interfaces\n\n### UINotificationFeedbackGenerator\n\nSystem-level success\u002Fwarning\u002Ferror feedback.\n\n**Types**:\n- `.success` - Task completed successfully\n- `.warning` - Attention needed, but not critical\n- `.error` - Critical error occurred\n\n**Usage**:\n```swift\nlet notificationGenerator = UINotificationFeedbackGenerator()\n\nfunc submitForm() {\n    \u002F\u002F Validate form\n    if isValid {\n        notificationGenerator.notificationOccurred(.success)\n        saveData()\n    } else {\n        notificationGenerator.notificationOccurred(.error)\n        showValidationErrors()\n    }\n}\n```\n\n**Best practice**: Match haptic type to user outcome\n- ✅ Payment succeeds → `.success`\n- ✅ Form validation fails → `.error`\n- ✅ Approaching storage limit → `.warning`\n\n### Performance: prepare()\n\nCall `prepare()` before the haptic to reduce latency:\n\n```swift\n\u002F\u002F ✅ Good - prepare before user action\n@IBAction func buttonTouchDown(_ sender: UIButton) {\n    impactGenerator.prepare()  \u002F\u002F User's finger is down\n}\n\n@IBAction func buttonTouchUpInside(_ sender: UIButton) {\n    impactGenerator.impactOccurred()  \u002F\u002F Immediate haptic\n}\n\n\u002F\u002F ❌ Bad - unprepared haptic may lag\n@IBAction func buttonTapped(_ sender: UIButton) {\n    let generator = UIImpactFeedbackGenerator()\n    generator.impactOccurred()  \u002F\u002F May have 10-20ms delay\n}\n```\n\n**Prepare timing**: System keeps engine ready for ~1 second after `prepare()`.\n\n---\n\n## Part 3: Core Haptics (Custom Haptics)\n\nFor apps needing custom patterns, `Core Haptics` provides full control over haptic waveforms.\n\n### Four Fundamental Elements\n\n1. **Engine** (`CHHapticEngine`) - Link to the phone's actuator\n2. **Player** (`CHHapticPatternPlayer`) - Playback control\n3. **Pattern** (`CHHapticPattern`) - Collection of events over time\n4. **Events** (`CHHapticEvent`) - Building blocks specifying the experience\n\n### CHHapticEngine Lifecycle\n\n```swift\nimport CoreHaptics\n\nclass HapticManager {\n    var engine: CHHapticEngine?\n\n    func initializeHaptics() {\n        \u002F\u002F Check device support\n        guard CHHapticEngine.capabilitiesForHardware().supportsHaptics else {\n            print(\"Device doesn't support haptics\")\n            return\n        }\n\n        do {\n            \u002F\u002F Create engine\n            engine = try CHHapticEngine()\n\n            \u002F\u002F Handle interruptions (calls, Siri, etc.)\n            engine?.stoppedHandler = { reason in\n                print(\"Engine stopped: \\(reason)\")\n                self.restartEngine()\n            }\n\n            \u002F\u002F Handle reset (audio session changes)\n            engine?.resetHandler = {\n                print(\"Engine reset\")\n                self.restartEngine()\n            }\n\n            \u002F\u002F Start engine\n            try engine?.start()\n\n        } catch {\n            print(\"Failed to create haptic engine: \\(error)\")\n        }\n    }\n\n    func restartEngine() {\n        do {\n            try engine?.start()\n        } catch {\n            print(\"Failed to restart engine: \\(error)\")\n        }\n    }\n}\n```\n\n**Critical**: Always set `stoppedHandler` and `resetHandler` to handle system interruptions.\n\n### CHHapticEvent Types\n\n#### Transient Events\n\nShort, discrete feedback (like a tap).\n\n```swift\nlet intensity = CHHapticEventParameter(\n    parameterID: .hapticIntensity,\n    value: 1.0  \u002F\u002F 0.0 to 1.0\n)\n\nlet sharpness = CHHapticEventParameter(\n    parameterID: .hapticSharpness,\n    value: 0.5  \u002F\u002F 0.0 (dull) to 1.0 (sharp)\n)\n\nlet event = CHHapticEvent(\n    eventType: .hapticTransient,\n    parameters: [intensity, sharpness],\n    relativeTime: 0.0  \u002F\u002F Seconds from pattern start\n)\n```\n\n**Parameters**:\n- `hapticIntensity`: Strength (0.0 = barely felt, 1.0 = maximum)\n- `hapticSharpness`: Character (0.0 = dull thud, 1.0 = crisp snap)\n\n#### Continuous Events\n\nSustained feedback over time (like a vibration motor).\n\n```swift\nlet intensity = CHHapticEventParameter(\n    parameterID: .hapticIntensity,\n    value: 0.8\n)\n\nlet sharpness = CHHapticEventParameter(\n    parameterID: .hapticSharpness,\n    value: 0.3\n)\n\nlet event = CHHapticEvent(\n    eventType: .hapticContinuous,\n    parameters: [intensity, sharpness],\n    relativeTime: 0.0,\n    duration: 2.0  \u002F\u002F Seconds\n)\n```\n\n**Use cases**:\n- Rolling texture as object moves\n- Motor running\n- Charging progress\n- Long press feedback\n\n### Creating and Playing Patterns\n\n```swift\nfunc playCustomPattern() {\n    \u002F\u002F Create events\n    let tap1 = CHHapticEvent(\n        eventType: .hapticTransient,\n        parameters: [\n            CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.5),\n            CHHapticEventParameter(parameterID: .hapticSharpness, value: 0.5)\n        ],\n        relativeTime: 0.0\n    )\n\n    let tap2 = CHHapticEvent(\n        eventType: .hapticTransient,\n        parameters: [\n            CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.7),\n            CHHapticEventParameter(parameterID: .hapticSharpness, value: 0.7)\n        ],\n        relativeTime: 0.3\n    )\n\n    let tap3 = CHHapticEvent(\n        eventType: .hapticTransient,\n        parameters: [\n            CHHapticEventParameter(parameterID: .hapticIntensity, value: 1.0),\n            CHHapticEventParameter(parameterID: .hapticSharpness, value: 1.0)\n        ],\n        relativeTime: 0.6\n    )\n\n    do {\n        \u002F\u002F Create pattern from events\n        let pattern = try CHHapticPattern(\n            events: [tap1, tap2, tap3],\n            parameters: []\n        )\n\n        \u002F\u002F Create player\n        let player = try engine?.makePlayer(with: pattern)\n\n        \u002F\u002F Play\n        try player?.start(atTime: CHHapticTimeImmediate)\n\n    } catch {\n        print(\"Failed to play pattern: \\(error)\")\n    }\n}\n```\n\n### CHHapticAdvancedPatternPlayer - Looping\n\nFor continuous feedback (rolling textures, motors), use advanced player:\n\n```swift\nfunc startRollingTexture() {\n    let event = CHHapticEvent(\n        eventType: .hapticContinuous,\n        parameters: [\n            CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.4),\n            CHHapticEventParameter(parameterID: .hapticSharpness, value: 0.2)\n        ],\n        relativeTime: 0.0,\n        duration: 0.5\n    )\n\n    do {\n        let pattern = try CHHapticPattern(events: [event], parameters: [])\n\n        \u002F\u002F Use advanced player for looping\n        let player = try engine?.makeAdvancedPlayer(with: pattern)\n\n        \u002F\u002F Enable looping\n        try player?.loopEnabled = true\n\n        \u002F\u002F Start\n        try player?.start(atTime: CHHapticTimeImmediate)\n\n        \u002F\u002F Update intensity dynamically based on ball speed\n        updateTextureIntensity(player: player)\n\n    } catch {\n        print(\"Failed to start texture: \\(error)\")\n    }\n}\n\nfunc updateTextureIntensity(player: CHHapticAdvancedPatternPlayer?) {\n    let newIntensity = calculateIntensityFromBallSpeed()\n\n    let intensityParam = CHHapticDynamicParameter(\n        parameterID: .hapticIntensityControl,\n        value: newIntensity,\n        relativeTime: 0\n    )\n\n    try? player?.sendParameters([intensityParam], atTime: CHHapticTimeImmediate)\n}\n```\n\n**Key difference**: `CHHapticPatternPlayer` plays once, `CHHapticAdvancedPatternPlayer` supports looping and dynamic parameter updates.\n\n---\n\n## Part 4: AHAP Files (Apple Haptic Audio Pattern)\n\nAHAP (Apple Haptic Audio Pattern) files are JSON files combining haptic events and audio.\n\n### Basic AHAP Structure\n\n```json\n{\n  \"Version\": 1.0,\n  \"Metadata\": {\n    \"Project\": \"My App\",\n    \"Created\": \"2024-01-15\"\n  },\n  \"Pattern\": [\n    {\n      \"Event\": {\n        \"Time\": 0.0,\n        \"EventType\": \"HapticTransient\",\n        \"EventParameters\": [\n          {\n            \"ParameterID\": \"HapticIntensity\",\n            \"ParameterValue\": 1.0\n          },\n          {\n            \"ParameterID\": \"HapticSharpness\",\n            \"ParameterValue\": 0.5\n          }\n        ]\n      }\n    }\n  ]\n}\n```\n\n### Adding Audio to AHAP\n\n```json\n{\n  \"Version\": 1.0,\n  \"Pattern\": [\n    {\n      \"Event\": {\n        \"Time\": 0.0,\n        \"EventType\": \"AudioCustom\",\n        \"EventParameters\": [\n          {\n            \"ParameterID\": \"AudioVolume\",\n            \"ParameterValue\": 0.8\n          }\n        ],\n        \"EventWaveformPath\": \"ShieldA.wav\"\n      }\n    },\n    {\n      \"Event\": {\n        \"Time\": 0.0,\n        \"EventType\": \"HapticContinuous\",\n        \"EventDuration\": 0.5,\n        \"EventParameters\": [\n          {\n            \"ParameterID\": \"HapticIntensity\",\n            \"ParameterValue\": 0.6\n          }\n        ]\n      }\n    }\n  ]\n}\n```\n\n### Loading AHAP Files\n\n```swift\nfunc loadAHAPPattern(named name: String) -> CHHapticPattern? {\n    guard let url = Bundle.main.url(forResource: name, withExtension: \"ahap\") else {\n        print(\"AHAP file not found\")\n        return nil\n    }\n\n    do {\n        return try CHHapticPattern(contentsOf: url)\n    } catch {\n        print(\"Failed to load AHAP: \\(error)\")\n        return nil\n    }\n}\n\n\u002F\u002F Usage\nif let pattern = loadAHAPPattern(named: \"ShieldTransient\") {\n    let player = try? engine?.makePlayer(with: pattern)\n    try? player?.start(atTime: CHHapticTimeImmediate)\n}\n```\n\n### Design Workflow (WWDC Example)\n\n1. **Create visual animation** (e.g., shield transformation, 500ms)\n2. **Design audio** (convey energy gain and robustness)\n3. **Design haptic** (feel the transformation)\n4. **Test harmony** - Do all three senses work together?\n5. **Iterate** - Swap AHAP assets until coherent\n6. **Implement** - Update code to use final assets\n\n**Example iteration**: Shield initially used 3 transient pulses (haptic) + progressive continuous sound (audio) → no harmony. Solution: Switch to continuous haptic + ShieldA.wav audio → unified experience.\n\n---\n\n## Part 5: Audio-Haptic Synchronization\n\n### Matching Animation Timing\n\n```swift\nclass ViewController: UIViewController {\n    let animationDuration: TimeInterval = 0.5\n\n    func performShieldTransformation() {\n        \u002F\u002F Start haptic\u002Faudio simultaneously with animation\n        playShieldPattern()\n\n        UIView.animate(withDuration: animationDuration) {\n            self.shieldView.transform = CGAffineTransform(scaleX: 1.2, y: 1.2)\n            self.shieldView.alpha = 0.8\n        }\n    }\n\n    func playShieldPattern() {\n        if let pattern = loadAHAPPattern(named: \"ShieldContinuous\") {\n            let player = try? engine?.makePlayer(with: pattern)\n            try? player?.start(atTime: CHHapticTimeImmediate)\n        }\n    }\n}\n```\n\n**Critical**: Fire haptic at the exact moment the visual change occurs, not before or after.\n\n### Coordinating with Audio\n\n```swift\nimport AVFoundation\n\nclass AudioHapticCoordinator {\n    let audioPlayer: AVAudioPlayer\n    let hapticEngine: CHHapticEngine\n\n    func playCoordinatedExperience() {\n        \u002F\u002F Prepare both systems\n        hapticEngine.notifyWhenPlayersFinished { _ in\n            return .stopEngine\n        }\n\n        \u002F\u002F Start at exact same moment\n        let startTime = CACurrentMediaTime() + 0.05  \u002F\u002F Small delay for sync\n\n        \u002F\u002F Start audio\n        audioPlayer.play(atTime: startTime)\n\n        \u002F\u002F Start haptic\n        if let pattern = loadAHAPPattern(named: \"CoordinatedPattern\") {\n            let player = try? hapticEngine.makePlayer(with: pattern)\n            try? player?.start(atTime: CHHapticTimeImmediate)\n        }\n    }\n}\n```\n\n---\n\n## Part 6: Common Patterns\n\n### Button Tap\n\n```swift\nclass HapticButton: UIButton {\n    let impactGenerator = UIImpactFeedbackGenerator(style: .medium)\n\n    override func touchesBegan(_ touches: Set\u003CUITouch>, with event: UIEvent?) {\n        super.touchesBegan(touches, with: event)\n        impactGenerator.prepare()\n    }\n\n    override func touchesEnded(_ touches: Set\u003CUITouch>, with event: UIEvent?) {\n        super.touchesEnded(touches, with: event)\n        impactGenerator.impactOccurred()\n    }\n}\n```\n\n### Slider Scrubbing\n\n```swift\nclass HapticSlider: UISlider {\n    let selectionGenerator = UISelectionFeedbackGenerator()\n    var lastValue: Float = 0\n\n    @objc func valueChanged() {\n        let threshold: Float = 0.1\n\n        if abs(value - lastValue) >= threshold {\n            selectionGenerator.selectionChanged()\n            lastValue = value\n        }\n    }\n}\n```\n\n### Pull-to-Refresh\n\n```swift\nclass PullToRefreshController: UIViewController {\n    let impactGenerator = UIImpactFeedbackGenerator(style: .medium)\n    var isRefreshing = false\n\n    func scrollViewDidScroll(_ scrollView: UIScrollView) {\n        let threshold: CGFloat = -100\n        let offset = scrollView.contentOffset.y\n\n        if offset \u003C= threshold && !isRefreshing {\n            impactGenerator.impactOccurred()\n            isRefreshing = true\n            beginRefresh()\n        }\n    }\n}\n```\n\n### Success\u002FError Feedback\n\n```swift\nfunc handleServerResponse(_ result: Result\u003CData, Error>) {\n    let notificationGenerator = UINotificationFeedbackGenerator()\n\n    switch result {\n    case .success:\n        notificationGenerator.notificationOccurred(.success)\n        showSuccessMessage()\n    case .failure:\n        notificationGenerator.notificationOccurred(.error)\n        showErrorAlert()\n    }\n}\n```\n\n---\n\n## Part 7: Testing & Debugging\n\n### Simulator Limitations\n\n**Haptics DO NOT work in Simulator**. You will see:\n- No haptic feedback\n- No warnings or errors\n- Code runs normally\n\n**Solution**: Always test on physical device (iPhone 8 or newer).\n\n### Device Testing Checklist\n\n- [ ] Test with Haptics disabled in Settings → Sounds & Haptics\n- [ ] Test with Low Power Mode enabled\n- [ ] Test during incoming call (engine may stop)\n- [ ] Test with audio playing in background\n- [ ] Test with different intensity\u002Fsharpness values\n- [ ] Verify battery impact (Instruments Energy Log)\n\n### Debug Logging\n\n```swift\nfunc playHaptic() {\n    #if DEBUG\n    print(\"? Playing haptic - Engine running: \\(engine?.currentTime ?? -1)\")\n    #endif\n\n    do {\n        let player = try engine?.makePlayer(with: pattern)\n        try player?.start(atTime: CHHapticTimeImmediate)\n\n        #if DEBUG\n        print(\"✅ Haptic started successfully\")\n        #endif\n    } catch {\n        #if DEBUG\n        print(\"❌ Haptic failed: \\(error.localizedDescription)\")\n        #endif\n    }\n}\n```\n\n---\n\n## Troubleshooting\n\n### Engine fails to start\n\n**Symptom**: `CHHapticEngine.start()` throws error\n\n**Causes**:\n1. Device doesn't support Core Haptics (\u003C iPhone 8)\n2. Haptics disabled in Settings\n3. Low Power Mode enabled\n\n**Solution**:\n```swift\nfunc safelyStartEngine() {\n    guard CHHapticEngine.capabilitiesForHardware().supportsHaptics else {\n        print(\"Device doesn't support haptics\")\n        return\n    }\n\n    do {\n        try engine?.start()\n    } catch {\n        print(\"Engine start failed: \\(error)\")\n        \u002F\u002F Fall back to UIFeedbackGenerator\n        useFallbackHaptics()\n    }\n}\n```\n\n### Haptics not felt\n\n**Symptom**: Code runs but no haptic felt on device\n\n**Debug steps**:\n1. Check Settings → Sounds & Haptics → System Haptics is ON\n2. Check Low Power Mode is OFF\n3. Verify device is iPhone 8 or newer\n4. Check intensity > 0.3 (values below may be too subtle)\n5. Test with UIFeedbackGenerator to isolate Core Haptics vs system issue\n\n### Audio out of sync with haptics\n\n**Symptom**: Audio plays but haptic delayed or vice versa\n\n**Causes**:\n1. Not calling `prepare()` before haptic\n2. Audio\u002Fhaptic started at different times\n3. Heavy main thread work blocking playback\n\n**Solution**:\n```swift\n\u002F\u002F ✅ Synchronized start\nfunc playCoordinated() {\n    impactGenerator.prepare()  \u002F\u002F Reduce latency\n\n    \u002F\u002F Start both simultaneously\n    audioPlayer.play()\n    impactGenerator.impactOccurred()\n}\n```\n\n### Audio file errors with AHAP\n\n**Symptom**: AHAP pattern fails to load or play\n\n**Cause**: Audio file > 4.2 MB or > 23 seconds\n\n**Solution**: Keep audio files small and short. Use compressed formats (AAC) and trim to essential duration.\n\n---\n\n## Resources\n\n**WWDC**: 2021-10278, 2019-520, 2019-223\n\n**Docs**: \u002Fcorehaptics, \u002Fcorehaptics\u002Fchhapticengine\n\n**Skills**: axiom-swiftui-animation-ref, axiom-ui-testing, axiom-accessibility-diag\n\n",{"name":5,"license":15,"metadata":38,"description":7},{"version":39},"1.0.0","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-haptics",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill axiom-haptics",{"tool":55,"command":56},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill axiom-haptics",{"tool":58,"command":59},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill axiom-haptics","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-haptics\u002FSKILL.md",true,[63],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"customize.toml","OTHER","其他",1738,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.augment\u002Fskills\u002Fbmad-cis-agent-creative-problem-solver\u002Fcustomize.toml",[70,79,88,97,103,109],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":33},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[76,77,78],"model","model hierarchy","model hierarchy skill",{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":33},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[85,86,87],"MCP","zoom","zoom mcp",{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":33},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[94,95,96,86],"sdk","zoom apps sdk","apps",{"skillNo":98,"name":99,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":33},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[99],{"skillNo":104,"name":105,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":33},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[105],{"skillNo":110,"name":111,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":33},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[111]]