How to remove "Select This Location" from the GMSPlacePicker Dialog

Dears

I want the user to restrict their choice of places only from GMSPlacepicker and not give them the opportunity to click "Select this place", which send Long and Lat only without the name of the place.

So my question is very hot to remove the "Select this location" button in the GMSPlacePicker dialog box.

Here is what I mean ..

enter image description here

Here is the code written ..

    @IBAction func LocationChooserPressed(_ sender: AnyObject) {

    let center = CLLocationCoordinate2DMake((locationManager.location?.coordinate.latitude)!, (locationManager.location?.coordinate.longitude)!)
    let northEast = CLLocationCoordinate2DMake(center.latitude + 0.001, center.longitude + 0.001)
    let southWest = CLLocationCoordinate2DMake(center.latitude - 0.001, center.longitude - 0.001)
    let viewport = GMSCoordinateBounds(coordinate: northEast, coordinate: southWest)
    let config = GMSPlacePickerConfig(viewport: viewport)
    placePicker = GMSPlacePicker(config: config)


    placePicker?.pickPlace( callback: { (place: GMSPlace?, error: Error?) -> Void in
        if let error = error {
            print("Pick Place error: \(error.localizedDescription)")
            return
        }

        if let place = place {
            self.nameLabel.text = place.name
            self.addressLabel.text = place.formattedAddress!.components(separatedBy: ", ").joined(separator: "\n")
            self.chosenLong = String(place.coordinate.longitude)
            self.chosenLat = String(place.coordinate.latitude)

        } else {
            //self.nameLabel.text = "No place selected"
            self.addressLabel.text = ""
        }
    })
}

I believe that there should be a setting or a flag that could remove this choice.

Your support is greatly appreciated. Thanks you

+4
source share

Source: https://habr.com/ru/post/1662014/


All Articles