Sandy
Sandy

Reputation: 1

GMSPlaceRectangularLocationOption iOS swift

I have a problem with googlePlace, I don't know how to solve this, thanks for those who will answer

use of unresolved 'GMSPlaceRectangularLocationOption'

let filter = GMSAutocompleteFilter() filter.locationRestriction = GMSPlaceRectangularLocationOption(neBoundsCorner, swBoundsCorner)

Upvotes: 0

Views: 853

Answers (1)

Ishara Meegahawala
Ishara Meegahawala

Reputation: 757

This is not available in latest SDK. But available via GMSAutocompleteFetcher. Set Bounds you want to restrict then set auto autocompleteBoundsMode

    fetcher = GMSAutocompleteFetcher(bounds: mapBounds, filter: filter)
    fetcher?.autocompleteBoundsMode = .restrict   // or .bias

Update (on 23rd Nov 2020) It seems this has further changed with new SDK. Now "locationBias" is property of GMSAutocompleteFilter. Bounds also moved to GMSAutocompleteFilter from GMSAutocompleteFetcher.

var filter = GMSAutocompleteFilter() 
let b = GMSCoordinateBounds(location: location.coordinate, radiusMeters: 100)
filter.origin = location
filter.locationBias = GMSPlaceRectangularLocationOption(b.northEast, b.southWest);
fetcher = GMSAutocompleteFetcher(filter: filter)

Upvotes: 2

Related Questions