Skip to content

Commit

Permalink
Clarified comments about API versions
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Nov 15, 2016
1 parent d46b1da commit 4192690
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MapboxDirections/MBRouteStep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ struct Road {
init(name: String?, ref: String?, destination: String?) {
var codes: [String]?
if let names = name, let ref = ref ?? destination {
// OSRM v5.5 encodes the ref separately from the name but redundantly includes the ref in the name for backwards compatibility. Remove the ref from the name.
// Mapbox Directions API v5 encodes the ref separately from the name but redundantly includes the ref in the name for backwards compatibility. Remove the ref from the name.
let parenthetical = "(\(ref))"
if names == ref {
self.names = nil
Expand All @@ -398,7 +398,7 @@ struct Road {
}
codes = ref.tagValuesSeparatedByString(";")
} else if let names = name, let codesRange = names.rangeOfString("\\(.+?\\)$", options: .RegularExpressionSearch, range: names.startIndex..<names.endIndex) {
// OSRM v5.0 encodes the ref inside a parenthetical. Remove the ref from the name.
// Mapbox Directions API v4 encodes the ref inside a parenthetical. Remove the ref from the name.
let parenthetical = names.substringWithRange(codesRange)
if names == ref ?? destination {
self.names = nil
Expand All @@ -411,7 +411,7 @@ struct Road {
codes = nil
}

// OSRM v5.5 combines the destination’s ref and name.
// Mapbox Directions API v5 combines the destination’s ref and name.
if let destination = destination where destination.containsString(": ") {
let destinationComponents = destination.componentsSeparatedByString(": ")
self.destinationCodes = destinationComponents.first?.tagValuesSeparatedByString(",")
Expand Down

0 comments on commit 4192690

Please sign in to comment.