GMSAutocompletePlaceSuggestion Class Reference

GMSAutocompletePlaceSuggestion Class Reference

Overview

This class represents a place suggestion of a full query based on a partially typed string.

Properties

NSAttributedString * attributedFullText
 The full description of the suggestion as a NSAttributedString.
NSAttributedString * attributedPrimaryText
 The primary text of a suggestion as a NSAttributedString, usually the name of the place.
NSAttributedString * attributedSecondaryText
 The secondary text of a suggestion as a NSAttributedString, usually the location of the place.
NSString * placeID
 A property representing the place ID of the suggestion, suitable for use in a place details request.
NSArray< NSString * > * types
 Autocomplete result types.
NSNumber * distanceMeters
 The straight line distance in meters between the origin and this suggestion if a valid origin is specified in the GMSAutocompleteFilter of the request.

Property Documentation

- (NSAttributedString*) attributedFullText [read, copy]

The full description of the suggestion as a NSAttributedString.

E.g., "Sydney Opera House, Sydney, New South Wales, Australia".

Every text range that matches the user input has a kGMSAutocompleteMatchAttribute. For example, you can make every match bold using enumerateAttribute:

   UIFont *regularFont = [UIFont systemFontOfSize:[UIFont labelFontSize]];
   UIFont *boldFont = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
   NSMutableAttributedString *bolded = [suggestion.attributedFullText mutableCopy];
   [bolded enumerateAttribute:kGMSAutocompleteMatchAttribute
                      inRange:NSMakeRange(0, bolded.length)
                      options:0
                   usingBlock:^(id value, NSRange range, BOOL *stop) {
                     UIFont *font = (value == nil) ? regularFont : boldFont;
                     [bolded addAttribute:NSFontAttributeName value:font range:range];
                   }];
   label.attributedText = bolded;
 
- (NSAttributedString*) attributedPrimaryText [read, copy]

The primary text of a suggestion as a NSAttributedString, usually the name of the place.

E.g. "Sydney Opera House".

Text ranges that match user input have a kGMSAutocompleteMatchAttribute, like attributedFullText.

- (NSAttributedString*) attributedSecondaryText [read, copy]

The secondary text of a suggestion as a NSAttributedString, usually the location of the place.

E.g. "Sydney, New South Wales, Australia".

Text ranges that match user input have a kGMSAutocompleteMatchAttribute, like attributedFullText.

May be nil.

- (NSString*) placeID [read, copy]

A property representing the place ID of the suggestion, suitable for use in a place details request.

- (NSArray<NSString *>*) types [read, copy]

Autocomplete result types.

Types are NSStrings, valid values are any types documented at <https://developers.google.com/places/ios-sdk/supported_types>.

- (NSNumber*) distanceMeters [read, assign]

The straight line distance in meters between the origin and this suggestion if a valid origin is specified in the GMSAutocompleteFilter of the request.