Contents

registerAudioResource(_:options:)

Registers an external audio to use as a custom waveform.

Declaration

func registerAudioResource(_ resourceURL: URL, options: [AnyHashable : Any] = [:]) throws -> CHHapticAudioResourceID

Parameters

  • resourceURL:

    A URL that identifies the location of the audio file to register.

  • options:

    A dictionary with audio resource keys and values that describe how to play this resource.

Mentioned in

Return Value

An identifier for the audio resource.

Discussion

Before you initialize a Core Haptics event with your own audio file, use this method to register the file with the engine. Reference external audio files using a URL.

Input the value that this method returns when creating the dictionary or event representation of a haptic pattern.

Topics

Audio Resource Keys

See Also

Registering Audio Resources