GMSAutocompletePrediction.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // GMSAutocompletePrediction.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. /*
  11. * Attribute name for match fragments in |GMSAutocompletePrediction| attributedFullText.
  12. */
  13. extern NSString *const kGMSAutocompleteMatchAttribute;
  14. /**
  15. * This class represents a prediction of a full query based on a partially typed string.
  16. */
  17. @interface GMSAutocompletePrediction : NSObject
  18. /**
  19. * The full description of the prediction as a NSAttributedString. E.g., "Sydney Opera House,
  20. * Sydney, New South Wales, Australia".
  21. *
  22. * Every text range that matches the user input has a |kGMSAutocompleteMatchAttribute|. For
  23. * example, you can make every match bold using enumerateAttribute:
  24. * <pre>
  25. * UIFont *regularFont = [UIFont systemFontOfSize:[UIFont labelFontSize]];
  26. * UIFont *boldFont = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
  27. *
  28. * NSMutableAttributedString *bolded = [prediction.attributedFullText mutableCopy];
  29. * [bolded enumerateAttribute:kGMSAutocompleteMatchAttribute
  30. * inRange:NSMakeRange(0, bolded.length)
  31. * options:0
  32. * usingBlock:^(id value, NSRange range, BOOL *stop) {
  33. * UIFont *font = (value == nil) ? regularFont : boldFont;
  34. * [bolded addAttribute:NSFontAttributeName value:font range:range];
  35. * }];
  36. *
  37. * label.attributedText = bolded;
  38. * </pre>
  39. */
  40. @property(nonatomic, copy, readonly) NSAttributedString *attributedFullText;
  41. /**
  42. * An optional property representing the place ID of the prediction, suitable for use in a place
  43. * details request.
  44. */
  45. @property(nonatomic, copy, readonly) NSString *placeID;
  46. /**
  47. * The types of this autocomplete result. Types are NSStrings, valid values are any types
  48. * documented at <https://developers.google.com/places/supported_types>.
  49. */
  50. @property(nonatomic, copy, readonly) NSArray *types;
  51. @end