A protocol that defines a standard pattern player capable of playing haptic patterns with fixed parameters.


protocol CHHapticPatternPlayer


Create instances of a pattern player through a CHHapticEngine object by calling a factory method such as makePlayer(with:). When you ask a pattern player to play a haptic pattern, the player submits those commands to the haptic engine on your behalf.

Use the advanced pattern player, CHHapticAdvancedPatternPlayer, when your haptic pattern needs to change during playback, or when you'd like to sync your haptic with a custom audio track. The advanced player allows your app to dynamically change haptic characteristics such as intensity and sharpness through dynamic parameters and parameter curves, capabilities not found in the standard player.


Starting and Stopping Playback

func start(atTime: TimeInterval)

Starts playing the pattern at the specified time.


func stop(atTime: TimeInterval)

Stops playing the pattern at the specified time.


func cancel()

Stops the pattern player immediately and returns the specified error.


Sending Parameters to a Haptic

func sendParameters([CHHapticDynamicParameter], atTime: TimeInterval)

Sends an array of haptic parameters, starting at the specified time.


func scheduleParameterCurve(CHHapticParameterCurve, atTime: TimeInterval)

Schedules a parameter curve to begin transitioning a parameter at a certain time.


Silencing Haptic Playback

var isMuted: Bool

A Boolean that silences all haptic and audio output from the player when set to true.



Inherits From

See Also

Creating Haptic Pattern Players

func makePlayer(with: CHHapticPattern) -> CHHapticPatternPlayer

Creates a standard haptic pattern player from a haptic pattern.

protocol CHHapticAdvancedPatternPlayer

A protocol that defines an advanced pattern player capable of looping, seeking, pausing, and resuming haptic playback.

func makeAdvancedPlayer(with: CHHapticPattern) -> CHHapticAdvancedPatternPlayer

Creates an advanced haptic pattern player from a haptic pattern.