VisualInstructionComponent

@objc(MBVisualInstructionComponent)
open class VisualInstructionComponent : NSObject, ComponentRepresentable

A component of a VisualInstruction that represents a single run of similarly formatted text or an image with a textual fallback representation.

  • The URL to an image representation of this component.

    The URL refers to an image that uses the device’s native screen scale.

    Declaration

    Swift

    @objc
    public var imageURL: URL?
  • An abbreviated representation of the text property.

    Declaration

    Swift

    @objc
    public var abbreviation: String?
  • The priority for which the component should be abbreviated.

    A component with a lower abbreviation priority value should be abbreviated before a component with a higher abbreviation priority value.

    Declaration

    Swift

    @objc
    public var abbreviationPriority: Int
  • The plain text representation of this component.

    Use this property if imageURL is nil or if the URL contained in that property is not yet available.

    Declaration

    Swift

    @objc
    public var text: String?
  • The type of visual instruction component. You can display the component differently depending on its type.

    Declaration

    Swift

    @objc
    public var type: VisualInstructionComponentType
  • Initializes a new visual instruction component object based on the given JSON dictionary representation.

    Declaration

    Swift

    @objc(initWithJSON:)
    public convenience init(json: [String : Any])

    Parameters

    json

    A JSON object that conforms to the banner component format described in the Directions API documentation.

  • Initializes a new visual instruction component object that displays the given information.

    Declaration

    Swift

    @objc
    public init(type: VisualInstructionComponentType, text: String?, imageURL: URL?, abbreviation: String?, abbreviationPriority: Int)

    Parameters

    type

    The type of visual instruction component.

    text

    The plain text representation of this component.

    imageURL

    The URL to an image representation of this component.

    abbreviation

    An abbreviated representation of text.

    abbreviationPriority

    The priority for which the component should be abbreviated.