GMSGeocoder.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // GMSGeocoder.h
  3. // Google Maps SDK for iOS
  4. //
  5. // Copyright 2012 Google Inc.
  6. //
  7. // Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
  8. // Service: https://developers.google.com/maps/terms
  9. //
  10. #import <CoreLocation/CoreLocation.h>
  11. #import <GoogleMaps/GMSAddress.h>
  12. @class GMSReverseGeocodeResponse;
  13. /** GMSGeocoder error codes, embedded in NSError. */
  14. typedef NS_ENUM(NSInteger, GMSGeocoderErrorCode) {
  15. kGMSGeocoderErrorInvalidCoordinate = 1,
  16. kGMSGeocoderErrorInternal,
  17. };
  18. /** Handler that reports a reverse geocoding response, or error. */
  19. typedef void (^GMSReverseGeocodeCallback)(GMSReverseGeocodeResponse *, NSError *);
  20. /**
  21. * Exposes a service for reverse geocoding. This maps Earth coordinates (latitude and longitude) to
  22. * a collection of addresses near that coordinate.
  23. */
  24. @interface GMSGeocoder : NSObject
  25. /* Convenience constructor for GMSGeocoder. */
  26. + (GMSGeocoder *)geocoder;
  27. /**
  28. * Reverse geocodes a coordinate on the Earth's surface.
  29. *
  30. * @param coordinate The coordinate to reverse geocode.
  31. * @param handler The callback to invoke with the reverse geocode results.
  32. * The callback will be invoked asynchronously from the main thread.
  33. */
  34. - (void)reverseGeocodeCoordinate:(CLLocationCoordinate2D)coordinate
  35. completionHandler:(GMSReverseGeocodeCallback)handler;
  36. @end
  37. /** A collection of results from a reverse geocode request. */
  38. @interface GMSReverseGeocodeResponse : NSObject<NSCopying>
  39. /** Returns the first result, or nil if no results were available. */
  40. - (GMSAddress *)firstResult;
  41. /** Returns an array of all the results (contains GMSAddress), including the first result. */
  42. - (NSArray *)results;
  43. @end