shmidt / GooglePlacesSearchController

Google Places autocompleting address search controller
MIT License
194 stars 44 forks source link

Filter by country #17

Closed dannyhines closed 6 years ago

dannyhines commented 6 years ago

Is there a way to only show results from the United States?

shmidt commented 6 years ago

Per https://developers.google.com/places/web-service/autocomplete: You should be able to do that by adding 'components' key to getPlaces fucntion.

fileprivate func getPlaces(_ searchString: String) {
        var params = [
            "input": escape(searchString),
            "types": placeType.description,
            "key": apiKey ?? "",
            "components": "country:us"
        ]
dannyhines commented 6 years ago

That was so fast, thanks a ton!

On Fri, Jan 26, 2018 at 7:03 PM, Dima Shmidt notifications@github.com wrote:

Closed #17 https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fshmidt%2FGooglePlacesSearchController%2Fissues%2F17&data=02%7C01%7Cdaniel.c.hines%40mail-service-3-mx.vanderbilt.edu%7C887d071892704c1582c308d56521cc61%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C636526118198276292&sdata=ZlfuymfGG4Xw6ZuhbEOmA9qgmCgaRAF6Ppq7JNaIij4%3D&reserved=0 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fshmidt%2FGooglePlacesSearchController%2Fissues%2F17%23event-1444624859&data=02%7C01%7Cdaniel.c.hines%40mail-service-3-mx.vanderbilt.edu%7C887d071892704c1582c308d56521cc61%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C636526118198276292&sdata=6UwObtHoeC4YXliFsK2uui7dtLDW4teiaYZnjDuKFmM%3D&reserved=0, or mute the thread https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAX4Vhp42kpT2-sMnusr10hX2My5Hi1jwks5tOnXogaJpZM4Ru5up&data=02%7C01%7Cdaniel.c.hines%40mail-service-3-mx.vanderbilt.edu%7C887d071892704c1582c308d56521cc61%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C636526118198276292&sdata=6UbwrJO46PR5QOilgA4DIXvKnus4j1dfKnbiq2kqauY%3D&reserved=0 .

-- Daniel Hines Computer Science Vanderbilt University '18