Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Autocomplete place country filter not working in iOS

let autocompleteController = GMSAutocompleteViewController()
autocompleteController.autocompleteFilter?.country = "AU"
autocompleteController.delegate = self
self.presentViewController(autocompleteController, animated: true, completion: nil)

I need only filter data for Australia so I want to filter data by country.

like image 416
Saumil Shah Avatar asked May 12 '16 10:05

Saumil Shah


2 Answers

The autocompleteFilter property is nil by default, so the line

autocompleteController.autocompleteFilter?.country = "AU"

doesn't do anything. Do it like this instead:

let filter = GMSAutocompleteFilter()
filter.country = "AU"
autocompleteController.autocompleteFilter = filter
like image 74
AndrewR Avatar answered Oct 16 '22 09:10

AndrewR


GMSAutocompleteViewController *controller = [[GMSAutocompleteViewController alloc]init];
    GMSAutocompleteFilter *filter = [[GMSAutocompleteFilter alloc]init];
    controller.delegate = self;
    filter.country = @"IN";
    controller.autocompleteFilter = filter;
like image 1
Paul.V Avatar answered Oct 16 '22 09:10

Paul.V