TechnologiesDevice, Sensors & Hardware

CoreHaptics

iOSmacOStvOSwatchOSvisionOS

CoreHaptics composes and plays custom haptic and audio patterns through the device's haptic engine on iOS, macOS, tvOS, and visionOS. You build a CHHapticPattern from individual CHHapticEvent instances, shape each event with a CHHapticEventParameter, CHHapticDynamicParameter, or CHHapticParameterCurve, and play it through a CHHapticPatternPlayer or CHHapticAdvancedPatternPlayer obtained from a CHHapticEngine. Use CHHapticDeviceCapability to determine what the current hardware supports and CHHapticError to handle failures from the engine.

Haptic Engine 1

Start the haptic engine and obtain players that produce haptic and audio output.

  • Cl
    CHHapticEngineiOS 13.0+
    @class CHHapticEngine

Haptic Patterns and Events 2

Build the haptic content by composing events into reusable patterns.

  • Cl
    CHHapticPatterniOS 13.0+
    @class CHHapticPattern
  • Cl
    CHHapticEventiOS 13.0+
    @class CHHapticEvent

Shaping Events with Parameters 4

Set and modulate the intensity, sharpness, and other attributes of haptic and audio events.

  • Cl
    CHHapticEventParameteriOS 13.0+
    @class CHHapticEventParameter
  • Cl
    CHHapticDynamicParameteriOS 13.0+
    @class CHHapticDynamicParameter
  • Cl
    CHHapticParameterCurve
    @class CHHapticParameterCurve
  • Pr
    CHHapticParameterAttributesiOS 13.0+
    @protocol CHHapticParameterAttributes

Playing Patterns 2

Start, stop, and control playback of a haptic pattern through the engine.

  • Pr
    CHHapticPatternPlayeriOS 13.0+
    @protocol CHHapticPatternPlayer
  • Pr
    CHHapticAdvancedPatternPlayeriOS 13.0+
    @protocol CHHapticAdvancedPatternPlayer

Capabilities and Errors 2

Query what the current hardware supports and handle failures reported by the engine.

  • Pr
    CHHapticDeviceCapabilityiOS 13.0+
    @protocol CHHapticDeviceCapability
  • St
    CHHapticErroriOS 13.0+
    A structure that describes errors thrown by the Core Haptics engine.

Type Aliases 3

  • Ty
    CHHapticAudioResourceKey
  • Ty
    CHHapticAudioResourceID
    @typedef CHHapticAudioResourceID
  • Ty
    CHHapticAdvancedPatternPlayerCompletionHandler
    @typedef CHHapticAdvancedPatternPlayerCompletionHandler
← Device, Sensors & Hardware