Match

open class Match : DirectionsResult
extension Match: Equatable

A Match object defines a single route that was created from a series of points that were matched against a road network.

Typically, you do not create instances of this class directly. Instead, you receive match objects when you pass a MatchOptions object into the Directions.calculate(_:completionHandler:) method.

  • Initializes a match.

    Typically, you do not create instances of this class directly. Instead, you receive match objects when you request matches using the Directions.calculate(_:completionHandler:) method.

    Declaration

    Swift

    public init(legs: [RouteLeg], shape: LineString?, distance: CLLocationDistance, expectedTravelTime: TimeInterval, confidence: Float, weight: Weight)

    Parameters

    legs

    The legs that are traversed in order.

    shape

    The matching roads or paths as a contiguous polyline.

    distance

    The matched path’s cumulative distance, measured in meters.

    expectedTravelTime

    The route’s expected travel time, measured in seconds.

    confidence

    A number between 0 and 1 that indicates the Map Matching API’s confidence that the match is accurate. A higher confidence means the match is more likely to be accurate.

    weight

    A Weight enum, which represents the weight given to a specific Match.

  • Creates a match from a decoder.

    Precondition

    If the decoder is decoding JSON data from an API response, the Decoder.userInfo dictionary must contain a MatchOptions object in the CodingUserInfoKey.options key. If it does not, a DirectionsCodingError.missingOptions error is thrown.

    Declaration

    Swift

    public required init(from decoder: Decoder) throws

    Parameters

    decoder

    The decoder of JSON-formatted API response data or a previously encoded Match object.

  • A Weight enum, which represents the weight given to a specific Match.

    Declaration

    Swift

    open var weight: Weight
  • A number between 0 and 1 that indicates the Map Matching API’s confidence that the match is accurate. A higher confidence means the match is more likely to be accurate.

    Declaration

    Swift

    open var confidence: Float
  • Declaration

    Swift

    public static func == (lhs: Match, rhs: Match) -> Bool