SpokenInstruction
open class SpokenInstruction : Codable
extension SpokenInstruction: Equatable
An instruction about an upcoming RouteStep
’s maneuver, optimized for speech synthesis.
The instruction is provided in two formats: plain text and text marked up according to the Speech Synthesis Markup Language (SSML). Use a speech synthesizer such as AVSpeechSynthesizer
or Amazon Polly to read aloud the instruction.
The distanceAlongStep
property is measured from the beginning of the step associated with this object. By contrast, the text
and ssmlText
properties refer to the details in the following step. It is also possible for the instruction to refer to two following steps simultaneously when needed for safe navigation.
-
Initialize a spoken instruction.
Declaration
Swift
public init(distanceAlongStep: LocationDistance, text: String, ssmlText: String)
Parameters
distanceAlongStep
A distance along the associated
RouteStep
at which to read the instruction aloud.text
A plain-text representation of the speech-optimized instruction.
ssmlText
A formatted representation of the speech-optimized instruction.
-
A distance along the associated
RouteStep
at which to read the instruction aloud.The distance is measured in meters from the beginning of the associated step.
Declaration
Swift
public let distanceAlongStep: LocationDistance
-
A plain-text representation of the speech-optimized instruction.
This representation is appropriate for speech synthesizers that lack support for the Speech Synthesis Markup Language (SSML), such as
AVSpeechSynthesizer
. For speech synthesizers that support SSML, use thessmlText
property instead.Declaration
Swift
public let text: String
-
A formatted representation of the speech-optimized instruction.
This representation is appropriate for speech synthesizers that support the Speech Synthesis Markup Language (SSML), such as Amazon Polly. Numbers and names are marked up to ensure correct pronunciation. For speech synthesizers that lack SSML support, use the
text
property instead.Declaration
Swift
public let ssmlText: String
-
Declaration
Swift
public static func == (lhs: SpokenInstruction, rhs: SpokenInstruction) -> Bool