EmptyStack
EmptyStack

Reputation: 51374

GMSAutocompleteFetcher country restriction

I'm telling GMSAutocompleteFetcher to restrict the autocompletion to be within 'US', but it's not listening to me and returning results from other countries too.

Below is how I'm telling it.

self.autocompleteFetcher = GMSAutocompleteFetcher()
self.autocompleteFetcher.autocompleteFilter?.type = .Address
self.autocompleteFetcher.autocompleteFilter?.country = "US"

Can you guys please help with this? Thanks in advance.

Upvotes: 2

Views: 929

Answers (1)

gasho
gasho

Reputation: 1931

I know it's old question but I will try to answer it. You have to initialize the filter first and then pass it to the fetcher's init as a parameter.

let fetcherFilter = GMSAutocompleteFilter()
fetcherFilter.country = "BG"
fetcher = GMSAutocompleteFetcher(bounds: nil, filter: fetcherFilter)

Upvotes: 7

Related Questions