GMSPlacePicker.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // GMSPlacePicker.h
  3. // Google Maps SDK for iOS
  4. //
  5. // Copyright 2014 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 <GoogleMaps/GMSPlacePickerConfig.h>
  11. /* Error domain used for Place Picker errors. */
  12. extern NSString * const kGMSPlacePickerErrorDomain;
  13. /* Error codes for |kGMSPlacePickerErrorDomain|. */
  14. typedef NS_ENUM(NSInteger, GMSPlacePickerErrorCode) {
  15. /**
  16. * Something unknown went wrong.
  17. */
  18. kGMSPlacePickerUnknownError = -1,
  19. /**
  20. * An internal error occurred in the Places API library.
  21. */
  22. kGMSPlacePickerInternalError = -2,
  23. /**
  24. * An invalid GMSPlacePickerConfig was used.
  25. */
  26. kGMSPlacePickerInvalidConfig = -3,
  27. /**
  28. * Attempted to perform simultaneous place picking operations.
  29. */
  30. kGMSPlacePickerOverlappingCalls = -4,
  31. };
  32. /**
  33. * The Place Picker is a dialog that allows the user to pick a |GMSPlace| using an interactive map
  34. * and other tools. Users can select the place they're at or nearby.
  35. */
  36. @interface GMSPlacePicker : NSObject
  37. /**
  38. * The configuration of the place picker, as passed in at initialization.
  39. */
  40. @property(nonatomic, readonly, copy) GMSPlacePickerConfig *config;
  41. /**
  42. * Initializes the place picker with a given configuration. This does not start the process of
  43. * picking a place.
  44. */
  45. - (instancetype)initWithConfig:(GMSPlacePickerConfig *)config;
  46. /**
  47. * Prompt the user to pick a place. The place picker is a full-screen window that appears on
  48. * [UIScreen mainScreen]. The place picker takes over the screen until the user cancels the
  49. * operation or picks a place. The supplied callback will be invoked with the chosen place, or nil
  50. * if no place was chosen.
  51. *
  52. * This method should be called on the main thread. The callback will also be invoked on the main
  53. * thread.
  54. *
  55. * It is not possible to have multiple place picking operations active at the same time. If this is
  56. * attempted, the second callback will be invoked with an error.
  57. *
  58. * A reference to the place picker must be retained for the duration of the place picking operation.
  59. * If the retain count of the place picker object becomes 0, the picking operation will be cancelled
  60. * and the callback will not be invoked.
  61. */
  62. - (void)pickPlaceWithCallback:(GMSPlaceResultCallback)callback;
  63. @end