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.
- ClCHHapticEngineiOS 13.0+@class CHHapticEngine
Haptic Patterns and Events 2
Build the haptic content by composing events into reusable patterns.
- ClCHHapticPatterniOS 13.0+@class CHHapticPattern
- ClCHHapticEventiOS 13.0+@class CHHapticEvent
Shaping Events with Parameters 4
Set and modulate the intensity, sharpness, and other attributes of haptic and audio events.
- ClCHHapticEventParameteriOS 13.0+@class CHHapticEventParameter
- ClCHHapticDynamicParameteriOS 13.0+@class CHHapticDynamicParameter
- ClCHHapticParameterCurve@class CHHapticParameterCurve
- PrCHHapticParameterAttributesiOS 13.0+@protocol CHHapticParameterAttributes
Playing Patterns 2
Start, stop, and control playback of a haptic pattern through the engine.
- PrCHHapticPatternPlayeriOS 13.0+@protocol CHHapticPatternPlayer
- PrCHHapticAdvancedPatternPlayeriOS 13.0+@protocol CHHapticAdvancedPatternPlayer
Capabilities and Errors 2
Query what the current hardware supports and handle failures reported by the engine.
- PrCHHapticDeviceCapabilityiOS 13.0+@protocol CHHapticDeviceCapability
- StCHHapticErroriOS 13.0+A structure that describes errors thrown by the Core Haptics engine.
Type Aliases 3
- TyCHHapticAudioResourceKey
- TyCHHapticAudioResourceID@typedef CHHapticAudioResourceID
- TyCHHapticAdvancedPatternPlayerCompletionHandler@typedef CHHapticAdvancedPatternPlayerCompletionHandler