GMSAutocompleteTableDataSource
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
@interface GMSAutocompleteTableDataSource
: NSObject <UITableViewDataSource, UITableViewDelegate>
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.
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
Delegate to be notified when a place is selected or picking is cancelled.
Declaration
Swift
@IBOutlet weak var delegate: (any GMSAutocompleteTableDataSourceDelegate)? { get set }
Objective-C
@property (nonatomic, weak, nullable) id<GMSAutocompleteTableDataSourceDelegate> delegate;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
Filter to apply to autocomplete suggestions (can be nil).
Declaration
Swift
var autocompleteFilter: GMSAutocompleteFilter? { get set }
Objective-C
@property (nonatomic, strong, nullable) GMSAutocompleteFilter *autocompleteFilter;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
The background color of table cells.
Declaration
Swift
var tableCellBackgroundColor: UIColor { get set }
Objective-C
@property (nonatomic, strong) __GMS_AVAILABLE_BUT_DEPRECATED_MSG UIColor *tableCellBackgroundColor;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
The color of the separator line between table cells.
Declaration
Swift
var tableCellSeparatorColor: UIColor { get set }
Objective-C
@property (nonatomic, strong) __GMS_AVAILABLE_BUT_DEPRECATED_MSG UIColor *tableCellSeparatorColor;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
The color of result name text in autocomplete results
Declaration
Swift
var primaryTextColor: UIColor { get set }
Objective-C
@property (nonatomic, strong) __GMS_AVAILABLE_BUT_DEPRECATED_MSG UIColor *primaryTextColor;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
The color used to highlight matching text in autocomplete results
Declaration
Swift
var primaryTextHighlightColor: UIColor { get set }
Objective-C
@property (nonatomic, strong) __GMS_AVAILABLE_BUT_DEPRECATED_MSG UIColor *primaryTextHighlightColor;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
The color of the second row of text in autocomplete results.
Declaration
Swift
var secondaryTextColor: UIColor { get set }
Objective-C
@property (nonatomic, strong) __GMS_AVAILABLE_BUT_DEPRECATED_MSG UIColor *secondaryTextColor;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
The tint color applied to controls in the Autocomplete view.
Declaration
Swift
var tintColor: UIColor? { get set }
Objective-C
@property (nonatomic, strong, nullable) UIColor *tintColor;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
The
GMSPlaceField
for specifying explicit place details to be requested. Default returns all available fields.Declaration
Swift
var placeFields: GMSPlaceField { get set }
Objective-C
@property (nonatomic) GMSPlaceField placeFields;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
The
GMSPlaceProperty
for specifying explicit place details to be requested. Default returns all available properties.Declaration
Swift
var placeProperties: [String] { get set }
Objective-C
@property (nonatomic, strong) __GMS_AVAILABLE_BUT_DEPRECATED_MSG NSArray<NSString *> *placeProperties;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
Initializes a data source.
Declaration
Swift
init()
Objective-C
- (nonnull instancetype)init;
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
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.This method is non-blocking.
Declaration
Swift
func sourceTextHasChanged(_ text: String?)
Objective-C
- (void)sourceTextHasChanged:(nullable NSString *)text;
Parameters
text
The partial text to autocomplete.
-
Deprecated
Use Places Swift SDK’s (https://developers.google.com/maps/documentation/places/ios-sdk/google-places-swift) placeAutocomplete API instead.
Clear all predictions.
NOTE: This will call the two delegate methods below:
didUpdateAutocompletePredictionsForResultsController:
didRequestAutocompletePredictionsForResultsController:
The implementation of this method is guaranteed to call these synchronously and in-order.
Declaration
Swift
func clearResults()
Objective-C
- (void)clearResults;