-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revamp API to be more idiomatic in Swift #41
Commits on May 20, 2016
-
Revamped API to be more idiomatic in Swift
Rewrote the library to more closely parallel 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. Geocoder 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 URLForGeocoding(options:) property. Removed the cancelGeocode() method; instead, directly cancel the NSURLSessionDataTask returned by geocode(options:completionHandler:). Added a shared (singleton) Geocoder 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 Geocoder object with the access token explicitly. A single geocoder object can handle multiple requests concurrently (since it just passes the requests off to the shared URL session). Unified geocodeAddressString(_:completionHandler:) and reverseGeocodeLocation(_:completionHandler:) into a single geocode(options:completionHandler:) method that takes a GeocodeOptions object. There are two subclasses of GeocodeOptions, ForwardGeocodeOptions and ReverseGeocodeOptions, that support all the options exposed by the Geocoding API. Effectively, this change adds support for the Geocoding API’s autocomplete and bbox options. Added an attribution parameter to the completion handler that contains required legal notices. The access_token parameter is now the last URL parameter instead of the first. Replaced the Placemark.Scope enum with the PlacemarkScope bitmask, which is implemented in Objective-C so that Objective-C code can use it too. Using a bitmask prevents client code from specifying a scope multiple times. Renamed AdministrativeArea to Region, reflecting the Geocoding API result type. For Placemark objects representing addresses and points of interest, the name property is no longer fully qualified; that is, it no longer contains the full administrative hierarchy. For the fully-qualified name, use the qualifiedName property. Properties such as country and postalCode return Placemark objects instead of strings; to get the name of e.g. the surrounding country, use the returned placemark object’s name property. A new qualifiers property returns the entire placemark hierarchy in indexer order, in case there’s any overlap between containing placemarks. Renamed ISOcountryCode to code; this property may be included in subnational placemarks, such as placemarks representing regions. Replaced the administrativeArea and subAdministrativeArea properties with administrativeRegion and district, respectively. Unlike the old subAdministrativeRegion property, district may be nil if it isn’t applicable. Renamed locality to place, and subLocality to neighborhood. Added a wikidataEntityIdentifier property corresponding to the Geocoding API’s wikidata property. Removed the CLLocationCoordinate2D equality operator to avoid conflicts with client code that may define the same. Upgraded Podfile to CocoaPods 1.0 format. Enabled code coverage gathering. Updated text fixtures and expectations. Fixes #39, fixes #40.
Configuration menu - View commit details
-
Copy full SHA for bc1ba74 - Browse repository at this point
Copy the full SHA bc1ba74View commit details
Commits on May 21, 2016
-
Added class prefix to Placemark in Objective-C. Removed class prefix from MBRectangularRegion in Swift. Renamed autocompletionEnabled to autocompletesQuery and moved it to ForwardGeocodeOptions, since it doesn’t make sense in ReverseGeocodeOptions.
Configuration menu - View commit details
-
Copy full SHA for 877e3cd - Browse repository at this point
Copy the full SHA 877e3cdView commit details -
Replaced focalCoordinate with focalLocation
It’s less awkward to work with an optional (nullable) object than a struct that has a magic value.
Configuration menu - View commit details
-
Copy full SHA for 8a37eae - Browse repository at this point
Copy the full SHA 8a37eaeView commit details -
Renamed wikidataEntityIdentifier to wikidataItemIdentifier
Wikidata tends to call them “items” these days.
Configuration menu - View commit details
-
Copy full SHA for f75f70d - Browse repository at this point
Copy the full SHA f75f70dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 487ef96 - Browse repository at this point
Copy the full SHA 487ef96View commit details -
Took formattedAddressLines private like it used to be. Added postalAddress to return a CNPostalAddress on iOS 9.0 and above. A CNPostalAddress from the Contacts framework is easier to work with than a full Address Book framework–style addressDictionary.
Configuration menu - View commit details
-
Copy full SHA for fa169d4 - Browse repository at this point
Copy the full SHA fa169d4View commit details -
Added RectangularRegion.contains(coordinate:)
CLRegion.containsCoordinate(_:) is marked unavailable, the return type is marked implicitly unwrapped as a workaround.
Configuration menu - View commit details
-
Copy full SHA for 1bf9e2c - Browse repository at this point
Copy the full SHA 1bf9e2cView commit details -
Configuration menu - View commit details
-
Copy full SHA for a1c3892 - Browse repository at this point
Copy the full SHA a1c3892View commit details -
Configuration menu - View commit details
-
Copy full SHA for 13f3e10 - Browse repository at this point
Copy the full SHA 13f3e10View commit details
Commits on May 22, 2016
-
Added examples in both Swift and Objective-C to the readme and updated the pod description to deemphasize the API’s similarity to CLGeocoder.
Configuration menu - View commit details
-
Copy full SHA for a13caa5 - Browse repository at this point
Copy the full SHA a13caa5View commit details -
Provide more details about API errors
Include a failure reason from the response body in a failed request’s error. Include a hint when the error is due to rate-limiting. Split raw request and response logic into a separate method. Fixes #26.
Configuration menu - View commit details
-
Copy full SHA for ea922a7 - Browse repository at this point
Copy the full SHA ea922a7View commit details -
Batch geocoding uses a separate method on Geocoder and separate ForwardBatchGeocodeOptions and ReverseBatchGeocodeOptions objects. The batch geocoding completion handler accepts more deeply nested data.
Configuration menu - View commit details
-
Copy full SHA for 65c5d6e - Browse repository at this point
Copy the full SHA 65c5d6eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 405e790 - Browse repository at this point
Copy the full SHA 405e790View commit details