GooglePlaces Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSAutocompletePlaceSuggestion
@interface GMSAutocompletePlaceSuggestion : NSObject
This class represents a place suggestion of a full query based on a partially typed string.
-
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;
Declaration
Swift
@NSCopying var attributedFullText: NSAttributedString { get }
Objective-C
@property (nonatomic, copy, readonly) NSAttributedString *_Nonnull attributedFullText;
-
Declaration
Swift
@NSCopying var attributedPrimaryText: NSAttributedString { get }
Objective-C
@property (nonatomic, copy, readonly) NSAttributedString *_Nonnull attributedPrimaryText;
-
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
.
Declaration
Swift
@NSCopying var attributedSecondaryText: NSAttributedString? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSAttributedString *attributedSecondaryText;
-
A property representing the place ID of the suggestion, suitable for use in a place details
request.
Declaration
Swift
var placeID: String { get }
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull placeID;
-
Declaration
Swift
var types: [String] { get }
Objective-C
@property (nonatomic, copy, readonly) NSArray<NSString *> *_Nonnull types;
-
The straight line distance in meters between the origin and this suggestion if a valid origin is
specified in the GMSAutocompleteFilter
of the request.
Declaration
Swift
var distanceMeters: NSNumber? { get }
Objective-C
@property (nonatomic, readonly, nullable) NSNumber *distanceMeters;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMSAutocompletePlaceSuggestion\u003c/code\u003e objects represent place suggestions generated from partial user input.\u003c/p\u003e\n"],["\u003cp\u003eThese suggestions provide attributed text representations for the full description, primary name, and secondary location details.\u003c/p\u003e\n"],["\u003cp\u003eEach suggestion includes a place ID for further place details requests and an array of relevant place types.\u003c/p\u003e\n"],["\u003cp\u003eOptionally, a distance in meters from a specified origin may be included.\u003c/p\u003e\n"]]],[],null,["# GooglePlaces Framework Reference\n\nGMSAutocompletePlaceSuggestion\n==============================\n\n @interface GMSAutocompletePlaceSuggestion : NSObject\n\nThis class represents a place suggestion of a full query based on a partially typed string.\n- `\n ``\n ``\n `\n\n ### [attributedFullText](#/c:objc(cs)GMSAutocompletePlaceSuggestion(py)attributedFullText)\n\n `\n ` \n The full description of the suggestion as a NSAttributedString. E.g., \"Sydney Opera House,\n Sydney, New South Wales, Australia\".\n\n Every text range that matches the user input has a [kGMSAutocompleteMatchAttribute](../Constants/kGMSAutocompleteMatchAttribute.html). For\n example, you can make every match bold using enumerateAttribute: \n\n ```\n UIFont *regularFont = [UIFont systemFontOfSize:[UIFont labelFontSize]];\n UIFont *boldFont = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];\n\n NSMutableAttributedString *bolded = [suggestion.attributedFullText mutableCopy];\n [bolded enumerateAttribute:kGMSAutocompleteMatchAttribute\n inRange:NSMakeRange(0, bolded.length)\n options:0\n usingBlock:^(id value, NSRange range, BOOL *stop) {\n UIFont *font = (value == nil) ? regularFont : boldFont;\n [bolded addAttribute:NSFontAttributeName value:font range:range];\n }];\n\n label.attributedText = bolded;\n \n ```\n\n \u003cbr /\u003e\n\n #### Declaration\n\n Swift \n\n @NSCopying var attributedFullText: NSAttributedString { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly) NSAttributedString *_Nonnull attributedFullText;\n\n- `\n ``\n ``\n `\n\n ### [attributedPrimaryText](#/c:objc(cs)GMSAutocompletePlaceSuggestion(py)attributedPrimaryText)\n\n `\n ` \n The primary text of a suggestion as a NSAttributedString, usually the name of the place.\n E.g. \"Sydney Opera House\".\n\n Text ranges that match user input have a [kGMSAutocompleteMatchAttribute](../Constants/kGMSAutocompleteMatchAttribute.html),\n like [attributedFullText](../Classes/GMSAutocompletePlaceSuggestion.html#/c:objc(cs)GMSAutocompletePlaceSuggestion(py)attributedFullText). \n\n #### Declaration\n\n Swift \n\n @NSCopying var attributedPrimaryText: NSAttributedString { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly) NSAttributedString *_Nonnull attributedPrimaryText;\n\n- `\n ``\n ``\n `\n\n ### [attributedSecondaryText](#/c:objc(cs)GMSAutocompletePlaceSuggestion(py)attributedSecondaryText)\n\n `\n ` \n The secondary text of a suggestion as a NSAttributedString, usually the location of the place.\n E.g. \"Sydney, New South Wales, Australia\".\n\n Text ranges that match user input have a [kGMSAutocompleteMatchAttribute](../Constants/kGMSAutocompleteMatchAttribute.html), like\n [attributedFullText](../Classes/GMSAutocompletePlaceSuggestion.html#/c:objc(cs)GMSAutocompletePlaceSuggestion(py)attributedFullText).\n\n May be `nil`. \n\n #### Declaration\n\n Swift \n\n @NSCopying var attributedSecondaryText: NSAttributedString? { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nullable) NSAttributedString *attributedSecondaryText;\n\n- `\n ``\n ``\n `\n\n ### [placeID](#/c:objc(cs)GMSAutocompletePlaceSuggestion(py)placeID)\n\n `\n ` \n A property representing the place ID of the suggestion, suitable for use in a place details\n request. \n\n #### Declaration\n\n Swift \n\n var placeID: String { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly) NSString *_Nonnull placeID;\n\n- `\n ``\n ``\n `\n\n ### [types](#/c:objc(cs)GMSAutocompletePlaceSuggestion(py)types)\n\n `\n ` \n Autocomplete result types. Types are NSStrings, valid values are any types\n documented at \u003chttps://developers.google.com/places/ios-sdk/supported_types\u003e. \n\n #### Declaration\n\n Swift \n\n var types: [String] { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly) NSArray\u003cNSString *\u003e *_Nonnull types;\n\n- `\n ``\n ``\n `\n\n ### [distanceMeters](#/c:objc(cs)GMSAutocompletePlaceSuggestion(py)distanceMeters)\n\n `\n ` \n The straight line distance in meters between the origin and this suggestion if a valid origin is\n specified in the [GMSAutocompleteFilter](../Classes/GMSAutocompleteFilter.html) of the request. \n\n #### Declaration\n\n Swift \n\n var distanceMeters: NSNumber? { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nullable) NSNumber *distanceMeters;"]]