Amutha Kumari
Amutha Kumari

Reputation: 125

How to filter GMSPlacesAutocompleteTypeFilter to obtain the Country result for both United states and canada

let filter = GMSAutocompleteFilter()
        filter.type = GMSPlacesAutocompleteTypeFilter.city
        filter.country = "USA" || "CA"

how to get 2 country results in google autocomplete

Upvotes: 2

Views: 2459

Answers (3)

Margi Palan
Margi Palan

Reputation: 31

It's possible to do using following syntax

filter.country = "CA|country:US"

reference link here.

Upvotes: 1

Rodrigo Mulkey
Rodrigo Mulkey

Reputation: 1

It's currently not possible. I would recommend using the web API, where you can send up to 5 ISO country codes in your query (see components under "optional parameters":

https://developers.google.com/places/web-service/autocomplete

Upvotes: 0

Ketan Parmar
Ketan Parmar

Reputation: 27448

If you check country property in GMSAutocompleteFilter class then you will found that it is string so I think you can't set multiple country in your filter. If it's allowing multiple country then it should be array or any collection instead of string! and in documentation also they haven't mentioned for multiple countries in filter! So, I think you can't set more than one country at a time in one filter!

Upvotes: 2

Related Questions