-
Notifications
You must be signed in to change notification settings - Fork 313
/
MBNavigator.swift
36 lines (34 loc) · 1.14 KB
/
MBNavigator.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Foundation
import MapboxNavigationNative
import CoreLocation
extension MBFixLocation {
convenience init(_ location: CLLocation) {
self.init(coordinate: location.coordinate,
time: location.timestamp,
speed: location.speed >= 0 ? location.speed as NSNumber : nil,
bearing: location.course >= 0 ? location.course as NSNumber : nil,
altitude: location.altitude as NSNumber,
accuracyHorizontal: location.horizontalAccuracy >= 0 ? location.horizontalAccuracy as NSNumber : nil,
provider: nil)
}
}
extension MBRouteState: CustomStringConvertible {
public var description: String {
switch self {
case .invalid:
return "invalid"
case .initialized:
return "initialized"
case .tracking:
return "tracking"
case .complete:
return "complete"
case .offRoute:
return "offRoute"
case .stale:
return "stale"
@unknown default:
fatalError("Indescribable route state \(rawValue)")
}
}
}