|
1 |
| -import MapKit |
2 |
| -#if !PMKCocoaPods |
3 |
| -import PromiseKit |
4 |
| -#endif |
5 |
| - |
6 |
| -/** |
7 |
| - To import the `MKDirections` category: |
8 |
| - |
9 |
| - use_frameworks! |
10 |
| - pod "PromiseKit/MapKit" |
11 |
| - |
12 |
| - And then in your sources: |
13 |
| - |
14 |
| - import PromiseKit |
15 |
| -*/ |
16 |
| -extension MKDirections { |
17 |
| -#if swift(>=4.2) |
18 |
| - /// Begins calculating the requested route information asynchronously. |
19 |
| - public func calculate() -> Promise<Response> { |
20 |
| - return Promise<Response>(cancellableTask: MKDirectionsTask(self)) { calculate(completionHandler: $0.resolve) } |
21 |
| - } |
22 |
| - |
23 |
| - /// Begins calculating the requested travel-time information asynchronously. |
24 |
| - public func calculateETA() -> Promise<ETAResponse> { |
25 |
| - return Promise<ETAResponse>(cancellableTask: MKDirectionsTask(self)) { calculateETA(completionHandler: $0.resolve) } |
26 |
| - } |
27 |
| -#else |
28 |
| - /// Begins calculating the requested route information asynchronously. |
29 |
| - public func calculate() -> Promise<MKDirectionsResponse> { |
30 |
| - return Promise<MKDirectionsResponse>(cancellableTask: MKDirectionsTask(self)) { calculate(completionHandler: $0.resolve) } |
31 |
| - } |
32 |
| - |
33 |
| - /// Begins calculating the requested travel-time information asynchronously. |
34 |
| - public func calculateETA() -> Promise<MKETAResponse> { |
35 |
| - return Promise<MKETAResponse>(cancellableTask: MKDirectionsTask(self)) { calculateETA(completionHandler: $0.resolve) } |
36 |
| - } |
37 |
| -#endif |
38 |
| -} |
| 1 | +import MapKit |
| 2 | +#if !PMKCocoaPods |
| 3 | +import PromiseKit |
| 4 | +#endif |
| 5 | + |
| 6 | +/** |
| 7 | + To import the `MKDirections` category: |
| 8 | + |
| 9 | + use_frameworks! |
| 10 | + pod "PromiseKit/MapKit" |
| 11 | + |
| 12 | + And then in your sources: |
| 13 | + |
| 14 | + import PromiseKit |
| 15 | +*/ |
| 16 | +extension MKDirections { |
| 17 | +#if swift(>=4.2) |
| 18 | + /// Begins calculating the requested route information asynchronously. |
| 19 | + public func calculate() -> Promise<Response> { |
| 20 | + return Promise<Response>(cancellableTask: MKDirectionsTask(self)) { calculate(completionHandler: $0.resolve) } |
| 21 | + } |
| 22 | + |
| 23 | + /// Begins calculating the requested travel-time information asynchronously. |
| 24 | + public func calculateETA() -> Promise<ETAResponse> { |
| 25 | + return Promise<ETAResponse>(cancellableTask: MKDirectionsTask(self)) { calculateETA(completionHandler: $0.resolve) } |
| 26 | + } |
| 27 | +#else |
| 28 | + /// Begins calculating the requested route information asynchronously. |
| 29 | + public func calculate() -> Promise<MKDirectionsResponse> { |
| 30 | + return Promise<MKDirectionsResponse>(cancellableTask: MKDirectionsTask(self)) { calculate(completionHandler: $0.resolve) } |
| 31 | + } |
| 32 | + |
| 33 | + /// Begins calculating the requested travel-time information asynchronously. |
| 34 | + public func calculateETA() -> Promise<MKETAResponse> { |
| 35 | + return Promise<MKETAResponse>(cancellableTask: MKDirectionsTask(self)) { calculateETA(completionHandler: $0.resolve) } |
| 36 | + } |
| 37 | +#endif |
| 38 | +} |
39 | 39 |
|
40 | 40 | private class MKDirectionsTask: CancellableTask {
|
41 | 41 | let directions: MKDirections
|
|
0 commit comments