Instance Property


A block that the haptic engine calls after recovering from a haptic server error.


var resetHandler: CHHapticEngine.ResetHandler { get set }


If the handler has to reset itself after a server failure, the system calls this block asynchronously. In this block, release all haptic pattern players and recreate them. The system preserves CHHapticPattern objects and CHHapticEngine properties across restarts. Consider trying to restart the engine inside the reset block.

self.hapticEngine.resetHandler = {
    print("Engine reset --> Restarting!")
    do {
        try self.hapticEngine.start()
    } catch {
        print("Failed to restart the engine: \(error)")

Callbacks to this block arrive on a non-main thread, so handle them in a thread-safe manner.

See Also

Handling Haptic Engine Resets

typealias CHHapticEngine.ResetHandler

A typealias for the block that the haptic engine calls after being reset.