MapboxDirections.swift, iOS SDK v3.4.2#44
Conversation
Only ignore CocoaPods files inside Example/.
Upgraded MapboxDirections.swift to a Carthage-powered commit on master. Upgraded Mapbox iOS SDK to v3.4.1.
Fixed CocoaPods warnings about SWIFT_VERSION being overridden.
|
This is already happening in #43 |
|
Builds are failing because |
|
I suspect we got lucky in mapbox/mapbox-directions-swift#102. Over here, there’s actually one additional level: a Podfile that depends on three levels of Carthage projects’ podspecs (MapboxNavigation, MapboxDirections, Polyline). Since this setup doesn’t seem to have a hope of passing, we’re going to move all the examples over to Carthage in #43. |
Rewrote the library to more closely parallel mapbox/MapboxGeocoder.swift#41 and mapbox/MapboxStatic.swift#19. Removed the class prefix from Swift but kept it for Objective-C. The goal is no longer to be a (poor) drop-in replacement for MapKit’s MKDirections API but rather to be as idiomatic as possible in Swift and Objective-C, with a priority on Swift. Symbols conform to platform naming conventions but in some cases eschew MapKit terminology in favor of Geocoding API terminology, so that api-documentation makes sense in the context of this library. Removed the dependency on RequestKit. This library chooses reasonable default networking behavior; if you need anything more sophisticated, you can access the URL request information to use with a custom NSURLSession. Directions no longer needs to be strongly held in order for the request to finish. Instead, the request is made against the shared URL session; to use a custom URL session, make the request yourself using the URL returned by the URLForCalculatingDirections(options:) method. Removed the cancel() method; instead, directly cancel the NSURLSessionDataTask returned by calculateDirections(options:completionHandler:). Added a shared (singleton) Directions object. Use the shared object if you’ve set your Mapbox access token in the MGLMapboxAccessToken key of your application’s Info.plist file. Otherwise, create a Directions object with the access token explicitly. A single directions object can handle multiple requests concurrently (since it just passes the requests off to the shared URL session). Eliminated the separate APIs for calculating ETAs. Instead, all the options supported by the Directions API, including flags for including steps and the overview geometry, are now exposed through a new RouteOptions class. Effectively, this change adds support for the geometries, overview, radiuses, steps, and continue_straight query parameters and allows the heading accuracy of any waypoint to be customized. However, note that steps are no longer returned by default, and the overview geometry is simplified by default. The access_token parameter is now the last URL parameter instead of the first. Broke out MBDirectionsRequest.TransportType into three profile identifier constants. You always specify a profile identifier, not a transport type. That makes the desired mode of transportation more open-ended. Removed the MBDirectionsResponse class in favor of passing the waypoints and routes from the response directly into the completion handler. Renamed Route.geometry to Route.coordinates. For Objective-C compatibility, all enums are backed by integer types instead of String, but they’re CustomStringConvertible to allow for the same expressiveness we’re used to in Swift. Error handling is much more robust now. Various error conditions returned by the API cause the localized failure reason and recovery suggestion to be set in the NSError object that is passed into the completion handler. Updated test fixtures and expectations for the v5 server-side API and the revamped client-side API, and updated examples. Fixes mapbox#41, fixes mapbox#43, fixes mapbox#44.
Upgraded MapboxDirections.swift to a Carthage-powered commit on master. Upgraded Mapbox iOS SDK to v3.4.1.
/cc @frederoni