Skip to content

Commit

Permalink
Added destination code
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Jul 30, 2017
1 parent 24305e1 commit 512530f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions OSRMTextInstructions/OSRMTextInstructions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ public class OSRMInstructionFormatter: Formatter {
// Decide which instruction string to use
// Destination takes precedence over name
var instruction: String
if let _ = step.destinations, let _ = step.exitCodes?.first, let obj = instructionObject["exit_destination"] {
if let _ = step.destinations ?? step.destinationCodes, let _ = step.exitCodes?.first, let obj = instructionObject["exit_destination"] {
instruction = obj
} else if let _ = step.destinations, let obj = instructionObject["destination"] {
} else if let _ = step.destinations ?? step.destinationCodes, let obj = instructionObject["destination"] {
instruction = obj
} else if let _ = step.exitCodes?.first, let obj = instructionObject["exit"] {
instruction = obj
Expand All @@ -243,7 +243,7 @@ public class OSRMInstructionFormatter: Formatter {
nthWaypoint = ordinalFormatter.string(from: (legIndex + 1) as NSNumber)
}
let exitCode = step.exitCodes?.first ?? ""
let destination = step.destinations?.first ?? ""
let destination = [step.destinationCodes, step.destinations].flatMap { $0?.first }.joined(separator: ": ")
var exitOrdinal: String = ""
if let exitIndex = step.exitIndex, exitIndex <= 10 {
exitOrdinal = ordinalFormatter.string(from: exitIndex as NSNumber)!
Expand Down

0 comments on commit 512530f

Please sign in to comment.