VoiceControllerDelegate
@objc(MBVoiceControllerDelegate)
public protocol VoiceControllerDelegate
The VoiceControllerDelegate
protocol defines methods that allow an object to respond to significant events related to spoken instructions.
-
Called when the voice controller failed to speak an instruction.
Declaration
Swift
@objc(voiceController:spokenInstrucionsDidFailWithError:) optional func voiceController(_ voiceController: RouteVoiceController, spokenInstructionsDidFailWith error: Error)
Parameters
voiceController
The voice controller that experienced the failure.
error
An error explaining the failure and its cause. The
MBSpokenInstructionErrorCodeKey
key of the error’s user info dictionary is aSpokenInstructionErrorCode
indicating the cause of the failure. -
Called when one spoken instruction interrupts another instruction currently being spoken.
Declaration
Swift
@objc(voiceController:didInterruptSpokenInstruction:withInstruction:) optional func voiceController(_ voiceController: RouteVoiceController, didInterrupt interruptedInstruction: SpokenInstruction, with interruptingInstruction: SpokenInstruction)
Parameters
voiceController
The voice controller that experienced the interruption.
interruptedInstruction
The spoken instruction currently in progress that has been interrupted.
interruptingInstruction
The spoken instruction that is interrupting the current instruction.
-
Called when a spoken is about to speak. Useful if it is necessary to give a custom instruction instead. Noting, changing the
distanceAlongStep
property onSpokenInstruction
will have no impact on when the instruction will be said.Declaration
Swift
@objc(voiceController:willSpeakSpokenInstruction:routeProgress:) optional func voiceController(_ voiceController: RouteVoiceController, willSpeak instruction: SpokenInstruction, routeProgress: RouteProgress) -> SpokenInstruction?