GMSPlace.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. //
  2. // GMSPlace.h
  3. // Google Places SDK for iOS
  4. //
  5. // Copyright 2016 Google LLC
  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 <UIKit/UIKit.h>
  12. #import "GMSPlacesDeprecationUtils.h"
  13. @class GMSAddressComponent;
  14. @class GMSOpeningHours;
  15. @class GMSPlacePhotoMetadata;
  16. @class GMSPlaceViewportInfo;
  17. @class GMSPlusCode;
  18. NS_ASSUME_NONNULL_BEGIN
  19. /**
  20. * \defgroup PlacesPriceLevel GMSPlacesPriceLevel
  21. * @{
  22. */
  23. /**
  24. * Describes the price level of a place.
  25. */
  26. typedef NS_ENUM(NSInteger, GMSPlacesPriceLevel) {
  27. kGMSPlacesPriceLevelUnknown = -1,
  28. kGMSPlacesPriceLevelFree = 0,
  29. kGMSPlacesPriceLevelCheap = 1,
  30. kGMSPlacesPriceLevelMedium = 2,
  31. kGMSPlacesPriceLevelHigh = 3,
  32. kGMSPlacesPriceLevelExpensive = 4,
  33. };
  34. /**@}*/
  35. /**
  36. * \defgroup PlaceOpenStatus GMSPlaceOpenStatus
  37. * @{
  38. */
  39. /**
  40. * Describes the open status of a place.
  41. */
  42. typedef NS_ENUM(NSInteger, GMSPlaceOpenStatus) {
  43. /** The place's open status is unknown. */
  44. GMSPlaceOpenStatusUnknown,
  45. /** The place is open. */
  46. GMSPlaceOpenStatusOpen,
  47. /** The place is not open. */
  48. GMSPlaceOpenStatusClosed,
  49. };
  50. /**@}*/
  51. /**
  52. * \defgroup PlacesBusinessStatus GMSPlacesBusinessStatus
  53. * @{
  54. */
  55. /**
  56. * Describes the business status of a place.
  57. */
  58. typedef NS_ENUM(NSInteger, GMSPlacesBusinessStatus) {
  59. /** The business status is not known. */
  60. GMSPlacesBusinessStatusUnknown,
  61. /** The business is operational. */
  62. GMSPlacesBusinessStatusOperational,
  63. /** The business is closed temporarily. */
  64. GMSPlacesBusinessStatusClosedTemporarily,
  65. /** The business is closed permanently. */
  66. GMSPlacesBusinessStatusClosedPermanently,
  67. };
  68. /**@}*/
  69. /**
  70. * Represents a particular physical place. A GMSPlace encapsulates information about a physical
  71. * location, including its name, location, and any other information we might have about it. This
  72. * class is immutable.
  73. */
  74. @interface GMSPlace : NSObject
  75. /** Name of the place. */
  76. @property(nonatomic, copy, readonly, nullable) NSString *name;
  77. /** Place ID of this place. */
  78. @property(nonatomic, copy, readonly, nullable) NSString *placeID;
  79. /**
  80. * Location of the place. The location is not necessarily the center of the Place, or any
  81. * particular entry or exit point, but some arbitrarily chosen point within the geographic extent of
  82. * the Place.
  83. */
  84. @property(nonatomic, readonly, assign) CLLocationCoordinate2D coordinate;
  85. /**
  86. * Phone number of this place, in international format, i.e. including the country code prefixed
  87. * with "+". For example, Google Sydney's phone number is "+61 2 9374 4000".
  88. */
  89. @property(nonatomic, copy, readonly, nullable) NSString *phoneNumber;
  90. /**
  91. * Address of the place as a simple string.
  92. */
  93. @property(nonatomic, copy, readonly, nullable) NSString *formattedAddress;
  94. /**
  95. * Five-star rating for this place based on user reviews.
  96. *
  97. * Ratings range from 1.0 to 5.0. 0.0 means we have no rating for this place (e.g. because not
  98. * enough users have reviewed this place).
  99. */
  100. @property(nonatomic, readonly, assign) float rating;
  101. /**
  102. * Price level for this place, as integers from 0 to 4.
  103. *
  104. * e.g. A value of 4 means this place is "$$$$" (expensive). A value of 0 means free (such as a
  105. * museum with free admission).
  106. */
  107. @property(nonatomic, readonly, assign) GMSPlacesPriceLevel priceLevel;
  108. /**
  109. * The types of this place. Types are NSStrings, valid values are any types documented at
  110. * <https://developers.google.com/places/ios-sdk/supported_types>.
  111. */
  112. @property(nonatomic, copy, readonly, nullable) NSArray<NSString *> *types;
  113. /** Website for this place. */
  114. @property(nonatomic, copy, readonly, nullable) NSURL *website;
  115. /**
  116. * The data provider attribution string for this place.
  117. *
  118. * These are provided as a NSAttributedString, which may contain hyperlinks to the website of each
  119. * provider.
  120. *
  121. * In general, these must be shown to the user if data from this GMSPlace is shown, as described in
  122. * the Places SDK Terms of Service.
  123. */
  124. @property(nonatomic, copy, readonly, nullable) NSAttributedString *attributions;
  125. /**
  126. * The recommended viewport for this place. May be nil if the size of the place is not known.
  127. *
  128. * This returns a viewport of a size that is suitable for displaying this place. For example, a
  129. * |GMSPlace| object representing a store may have a relatively small viewport, while a |GMSPlace|
  130. * object representing a country may have a very large viewport.
  131. */
  132. @property(nonatomic, strong, readonly, nullable) GMSPlaceViewportInfo *viewportInfo;
  133. /**
  134. * An array of |GMSAddressComponent| objects representing the components in the place's address.
  135. * These components are provided for the purpose of extracting structured information about the
  136. * place's address: for example, finding the city that a place is in.
  137. *
  138. * These components should not be used for address formatting. If a formatted address is required,
  139. * use the |formattedAddress| property, which provides a localized formatted address.
  140. */
  141. @property(nonatomic, copy, readonly, nullable) NSArray<GMSAddressComponent *> *addressComponents;
  142. /**
  143. * The Plus code representation of location for this place.
  144. */
  145. @property(nonatomic, strong, readonly, nullable) GMSPlusCode *plusCode;
  146. /**
  147. * The Opening Hours information for this place.
  148. * Includes open status, periods and weekday text when available.
  149. */
  150. @property(nonatomic, strong, readonly, nullable) GMSOpeningHours *openingHours;
  151. /**
  152. * Represents how many reviews make up this place's rating.
  153. */
  154. @property(nonatomic, readonly, assign) NSUInteger userRatingsTotal;
  155. /**
  156. * An array of |GMSPlacePhotoMetadata| objects representing the photos of the place.
  157. */
  158. @property(nonatomic, copy, readonly, nullable) NSArray<GMSPlacePhotoMetadata *> *photos;
  159. /**
  160. * The timezone UTC offset of the place in minutes.
  161. */
  162. @property(nonatomic, readonly, nullable) NSNumber *UTCOffsetMinutes;
  163. /**
  164. * The |GMSPlaceBusinessStatus| of the place.
  165. */
  166. @property(nonatomic, readonly) GMSPlacesBusinessStatus businessStatus;
  167. /**
  168. * Default init is not available.
  169. */
  170. - (instancetype)init NS_UNAVAILABLE;
  171. /**
  172. * Calculates if a place is open based on |openingHours|, |UTCOffsetMinutes|, and |date|.
  173. *
  174. * @param date A reference point in time used to determine if the place is open.
  175. * @return GMSPlaceOpenStatusOpen if the place is open, GMSPlaceOpenStatusClosed if the place is
  176. * closed, and GMSPlaceOpenStatusUnknown if the open status is unknown.
  177. */
  178. - (GMSPlaceOpenStatus)isOpenAtDate:(NSDate *)date;
  179. /**
  180. * Calculates if a place is open based on |openingHours|, |UTCOffsetMinutes|, and current date
  181. * and time obtained from |[NSDate date]|.
  182. *
  183. * @return GMSPlaceOpenStatusOpen if the place is open, GMSPlaceOpenStatusClosed if the place is
  184. * closed, and GMSPlaceOpenStatusUnknown if the open status is unknown.
  185. */
  186. - (GMSPlaceOpenStatus)isOpen;
  187. /**
  188. * Background color of the icon according to Place type, to color the view behind the icon.
  189. */
  190. @property(nonatomic, readonly, nullable) UIColor *iconBackgroundColor;
  191. /**
  192. * The URL according to Place type, which you can use to retrieve the NSData of the Place icon.
  193. * NOTES: URL link does not expire and the image size aspect ratio may be different depending on
  194. * type.
  195. */
  196. @property(nonatomic, readonly, nullable) NSURL *iconImageURL;
  197. @end
  198. NS_ASSUME_NONNULL_END