Address search and reverse geocoding in Swift or Objective-C on iOS, macOS, tvOS, and watchOS
MBReverseGeocodeOptions
and MBForwardGeocodeOptions
from being available to Objective-C code. (#130)Geocoder.geocode(_:completionHandler:)
if the Mapbox Geocoding API returns a malformed response. Now an error would be passed to the completion handler instead. (#127)Beginning with this release, MapboxGeocoder.swift is written in Swift 4 (#122). There are no other significant changes since v0.6.3.
Changes since v0.5.2:
This will be the final Swift 2.x release. Changes since v0.5.1:
allowedScopes
property is now available in Objective-C. (#63)Landmark
scope, which is a subset of the PointOfInterest
scope. (#81, #86)RectangularRegion.allowedRegion
. (#84)formattedAddressLines
now recognize the reversed and delimiterless address format used in Chinese. (#77)Changes since v0.5.0:
error
parameter contains an NSError object with an explanation of the reason for the failure and a recovery suggestion. (#49, #55)RectangularRegion.containsCoordinate(_:)
to contains(_:)
to avoid a conflict with an obsolete method in Core Location. (#52)locale
option that determines the display language of geocoder results. (#53)This is a complete rewrite of MapboxGeocoder.swift that focuses on making the API more Swift-like in Swift but also improves Objective-C support (#41). The goal is no longer to be a drop-in replacement for Core Location’s CLGeocoder API, but the library continues to use terminology familiar to Cocoa and Cocoa Touch developers. This version includes a number of breaking changes:
MB
class prefix from Swift but kept it for Objective-C.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. (You may have already done so if you’ve installed the Mapbox iOS SDK or Mapbox OS X SDK.) Otherwise, create a Geocoder
object with the access token explicitly.NBNRequestKit
dependency override.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.cancelGeocode()
method; instead, directly cancel the NSURLSessionDataTask returned by geocode(options:completionHandler:)
.geocodeAddressString(_:completionHandler:)
and reverseGeocodeLocation(_:completionHandler:)
with a single geocode(options:completionHandler:)
method that takes a GeocodeOptions
object. The two concrete subclasses of GeocodeOptions
, ForwardGeocodeOptions
and ReverseGeocodeOptions
, support all the options exposed by the Geocoding API.Placemark.Scope
enum with a PlacemarkScope
bitmask. Renamed .AdministrativeArea
to .Region
.CLLocationCoordinate2D
equality operator to avoid conflicts with client code that may define the same.There are also many breaking changes to the Placemark
object that results from a request to the API:
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.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.ISOcountryCode
to code
. This property may be included in subnational placemarks, such as placemarks representing regions.administrativeArea
and subAdministrativeArea
properties with administrativeRegion
and district
, respectively. Unlike the old subAdministrativeRegion
property, district
may be nil
if it isn’t applicable.locality
to place
, and subLocality
to neighborhood
.Other changes since v0.4.2:
CNPostalAddress
class. You can directly forward geocode a CNPostalAddress
. You can also get the postalAddress
of a placemark, suitable to format with CNPostalAddressFormatter
or place inside a CNContact
. (#41, #42)ForwardBatchGeocodeOptions
and ForwardReverseGeocodeOptions
. (#41)superiorPlacemarks
property returns the entire hierarchy of placemarks (in indexer order) that contain a given placemark, in case there’s any overlap between containing placemarks. (#41)wikidataItemIdentifier
property identifying a placemark’s corresponding Wikidata item. (#41)