GMSAutocompleteTableDataSource provides an interface for providing place autocomplete
predictions to populate a UITableView by implementing the UITableViewDataSource and
UITableViewDelegate protocols.
GMSAutocompleteTableDataSource is designed to be used as the data source for a
UISearchDisplayController.
NOTE: UISearchDisplayController has been deprecated since iOS 8. It is now recommended to use
UISearchController with GMSAutocompleteResultsViewController to display autocomplete results
using the iOS search UI.
Set an instance of GMSAutocompleteTableDataSource as the searchResultsDataSource and
searchResultsDelegate properties of UISearchDisplayController. In your implementation of
shouldReloadTableForSearchString, call sourceTextHasChanged with the current search string.
Use the GMSAutocompleteTableDataSourceDelegate delegate protocol to be notified when a place is
selected from the list. Because autocomplete predictions load asynchronously, it is necessary
to implement didUpdateAutocompletePredictions and call reloadData on the
UISearchDisplayController‘s table view.
Notify the data source that the source text to autocomplete has changed.
This method should only be called from the main thread. Calling this method from another thread
will result in undefined behavior. Calls to GMSAutocompleteTableDataSourceDelegate methods will
also be called on the main thread.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMSAutocompleteTableDataSource\u003c/code\u003e populates a \u003ccode\u003eUITableView\u003c/code\u003e with place autocomplete predictions using the \u003ccode\u003eUITableViewDataSource\u003c/code\u003e and \u003ccode\u003eUITableViewDelegate\u003c/code\u003e protocols.\u003c/p\u003e\n"],["\u003cp\u003eWhile designed for \u003ccode\u003eUISearchDisplayController\u003c/code\u003e, using \u003ccode\u003eUISearchController\u003c/code\u003e with \u003ccode\u003eGMSAutocompleteResultsViewController\u003c/code\u003e is recommended for displaying autocomplete results in iOS search UI.\u003c/p\u003e\n"],["\u003cp\u003eImplement the \u003ccode\u003eGMSAutocompleteTableDataSourceDelegate\u003c/code\u003e protocol to handle place selection and prediction updates.\u003c/p\u003e\n"],["\u003cp\u003eCustomize appearance through properties like \u003ccode\u003etableCellBackgroundColor\u003c/code\u003e, \u003ccode\u003eprimaryTextColor\u003c/code\u003e, and \u003ccode\u003etintColor\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eControl the details fetched by setting \u003ccode\u003eplaceFields\u003c/code\u003e for \u003ca href=\"../Enums/GMSPlaceField.html\"\u003eGMSPlaceField\u003c/a\u003e and \u003ccode\u003eplaceProperties\u003c/code\u003e for \u003ca href=\"../Type-Definitions/GMSPlaceProperty.html\"\u003eGMSPlaceProperty\u003c/a\u003e.\u003c/p\u003e\n"]]],["`GMSAutocompleteTableDataSource` provides place autocomplete predictions for a `UITableView`. It acts as the data source and delegate for `UISearchDisplayController`, though `UISearchController` is now preferred. Key actions include setting it as the `searchResultsDataSource` and `searchResultsDelegate`, and calling `sourceTextHasChanged` with the search string to trigger predictions. It also allows setting a filter and customizing appearance like colors. You can use `clearResults` to clear all current predictions, and you can specify the desired `placeFields` and `placeProperties`.\n"],null,["# GooglePlaces Framework Reference\n\nGMSAutocompleteTableDataSource\n==============================\n\n @interface GMSAutocompleteTableDataSource\n : NSObject \u003cUITableViewDataSource, UITableViewDelegate\u003e\n\n`GMSAutocompleteTableDataSource` provides an interface for providing place autocomplete\npredictions to populate a UITableView by implementing the UITableViewDataSource and\nUITableViewDelegate protocols.\n\n`GMSAutocompleteTableDataSource` is designed to be used as the data source for a\nUISearchDisplayController.\n\nNOTE: `UISearchDisplayController` has been deprecated since iOS 8. It is now recommended to use\nUISearchController with [GMSAutocompleteResultsViewController](../Classes/GMSAutocompleteResultsViewController.html) to display autocomplete results\nusing the iOS search UI.\n\nSet an instance of `GMSAutocompleteTableDataSource` as the searchResultsDataSource and\nsearchResultsDelegate properties of `UISearchDisplayController`. In your implementation of\n`shouldReloadTableForSearchString`, call `sourceTextHasChanged` with the current search string.\n\nUse the [GMSAutocompleteTableDataSourceDelegate](../Protocols/GMSAutocompleteTableDataSourceDelegate.html) delegate protocol to be notified when a place is\nselected from the list. Because autocomplete predictions load asynchronously, it is necessary\nto implement `didUpdateAutocompletePredictions` and call reloadData on the\n`UISearchDisplayController`'s table view.\n- `\n ``\n ``\n `\n\n ### [delegate](#/c:objc(cs)GMSAutocompleteTableDataSource(py)delegate)\n\n `\n ` \n Delegate to be notified when a place is selected or picking is cancelled. \n\n #### Declaration\n\n Swift \n\n @IBOutlet weak var delegate: (any ../Protocols/GMSAutocompleteTableDataSourceDelegate.html)? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) id\u003c../Protocols/GMSAutocompleteTableDataSourceDelegate.html\u003e delegate;\n\n- `\n ``\n ``\n `\n\n ### [autocompleteFilter](#/c:objc(cs)GMSAutocompleteTableDataSource(py)autocompleteFilter)\n\n `\n ` \n Filter to apply to autocomplete suggestions (can be nil). \n\n #### Declaration\n\n Swift \n\n var autocompleteFilter: ../Classes/GMSAutocompleteFilter.html? { get set }\n\n Objective-C \n\n @property (nonatomic, strong, nullable) ../Classes/GMSAutocompleteFilter.html *autocompleteFilter;\n\n- `\n ``\n ``\n `\n\n ### [tableCellBackgroundColor](#/c:objc(cs)GMSAutocompleteTableDataSource(py)tableCellBackgroundColor)\n\n `\n ` \n The background color of table cells. \n\n #### Declaration\n\n Swift \n\n var tableCellBackgroundColor: UIColor { get set }\n\n Objective-C \n\n @property (nonatomic, strong) UIColor *_Nonnull tableCellBackgroundColor;\n\n- `\n ``\n ``\n `\n\n ### [tableCellSeparatorColor](#/c:objc(cs)GMSAutocompleteTableDataSource(py)tableCellSeparatorColor)\n\n `\n ` \n The color of the separator line between table cells. \n\n #### Declaration\n\n Swift \n\n var tableCellSeparatorColor: UIColor { get set }\n\n Objective-C \n\n @property (nonatomic, strong) UIColor *_Nonnull tableCellSeparatorColor;\n\n- `\n ``\n ``\n `\n\n ### [primaryTextColor](#/c:objc(cs)GMSAutocompleteTableDataSource(py)primaryTextColor)\n\n `\n ` \n The color of result name text in autocomplete results \n\n #### Declaration\n\n Swift \n\n var primaryTextColor: UIColor { get set }\n\n Objective-C \n\n @property (nonatomic, strong) UIColor *_Nonnull primaryTextColor;\n\n- `\n ``\n ``\n `\n\n ### [primaryTextHighlightColor](#/c:objc(cs)GMSAutocompleteTableDataSource(py)primaryTextHighlightColor)\n\n `\n ` \n The color used to highlight matching text in autocomplete results \n\n #### Declaration\n\n Swift \n\n var primaryTextHighlightColor: UIColor { get set }\n\n Objective-C \n\n @property (nonatomic, strong) UIColor *_Nonnull primaryTextHighlightColor;\n\n- `\n ``\n ``\n `\n\n ### [secondaryTextColor](#/c:objc(cs)GMSAutocompleteTableDataSource(py)secondaryTextColor)\n\n `\n ` \n The color of the second row of text in autocomplete results. \n\n #### Declaration\n\n Swift \n\n var secondaryTextColor: UIColor { get set }\n\n Objective-C \n\n @property (nonatomic, strong) UIColor *_Nonnull secondaryTextColor;\n\n- `\n ``\n ``\n `\n\n ### [tintColor](#/c:objc(cs)GMSAutocompleteTableDataSource(py)tintColor)\n\n `\n ` \n The tint color applied to controls in the Autocomplete view. \n\n #### Declaration\n\n Swift \n\n var tintColor: UIColor? { get set }\n\n Objective-C \n\n @property (nonatomic, strong, nullable) UIColor *tintColor;\n\n- `\n ``\n ``\n `\n\n ### [placeFields](#/c:objc(cs)GMSAutocompleteTableDataSource(py)placeFields)\n\n `\n ` \n The [GMSPlaceField](../Enums/GMSPlaceField.html) for specifying explicit place details to be requested. Default returns\n all available fields. \n\n #### Declaration\n\n Swift \n\n var placeFields: ../Enums/GMSPlaceField.html { get set }\n\n Objective-C \n\n @property (nonatomic) ../Enums/GMSPlaceField.html placeFields;\n\n- `\n ``\n ``\n `\n\n ### [placeProperties](#/c:objc(cs)GMSAutocompleteTableDataSource(py)placeProperties)\n\n `\n ` \n The [GMSPlaceProperty](../Type-Definitions/GMSPlaceProperty.html) for specifying explicit place details to be requested. Default returns\n all available properties. \n\n #### Declaration\n\n Swift \n\n var placeProperties: [String] { get set }\n\n Objective-C \n\n @property (nonatomic, strong) NSArray\u003cNSString *\u003e *_Nonnull placeProperties;\n\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)GMSAutocompleteTableDataSource(im)init)\n\n `\n ` \n Initializes a data source. \n\n #### Declaration\n\n Swift \n\n init()\n\n Objective-C \n\n - (nonnull instancetype)init;\n\n- `\n ``\n ``\n `\n\n ### [-sourceTextHasChanged:](#/c:objc(cs)GMSAutocompleteTableDataSource(im)sourceTextHasChanged:)\n\n `\n ` \n Notify the data source that the source text to autocomplete has changed.\n\n This method should only be called from the main thread. Calling this method from another thread\n will result in undefined behavior. Calls to [GMSAutocompleteTableDataSourceDelegate](../Protocols/GMSAutocompleteTableDataSourceDelegate.html) methods will\n also be called on the main thread.\n\n This method is non-blocking. \n\n #### Declaration\n\n Swift \n\n func sourceTextHasChanged(_ text: String?)\n\n Objective-C \n\n - (void)sourceTextHasChanged:(nullable NSString *)text;\n\n #### Parameters\n\n |--------------|-----------------------------------|\n | ` `*text*` ` | The partial text to autocomplete. |\n\n- `\n ``\n ``\n `\n\n ### [-clearResults](#/c:objc(cs)GMSAutocompleteTableDataSource(im)clearResults)\n\n `\n ` \n Clear all predictions.\n\n NOTE: This will call the two delegate methods below:\n - `didUpdateAutocompletePredictionsForResultsController:`\n - `didRequestAutocompletePredictionsForResultsController:`\n\n The implementation of this method is guaranteed to call these synchronously and in-order. \n\n #### Declaration\n\n Swift \n\n func clearResults()\n\n Objective-C \n\n - (void)clearResults;"]]