swift - How I can retrieve the coordinates by searching the place -


i'm facing problem while retrieving data google map place autocomplete because view did load latitude , longitude [unity] sare default while showing map

let camera = gmscameraposition.camera(withlatitude: 30.7096, longitude: 76.7016, zoom: 12)  let mapview = gmsmapview.map(withframe: cgrect(x: 0, y: 58, width: 320, height: 510), camera: camera)      let marker = gmsmarker()     marker.position = camera.target     marker.snippet = "hello world"     marker.map = mapview     self.mapsize.addsubview(mapview) }  @ibaction func autocompleteclicked(_ sender: uibutton) {     let autocompletecontroller = gmsautocompleteviewcontroller()     autocompletecontroller.delegate = self as! gmsautocompleteviewcontrollerdelegate     present(autocompletecontroller, animated: true, completion: nil) }  @iboutlet weak var mapsize: uiview! 

did implement gmsautocompleteviewcontrollerdelegate protocol in parent view controller?

    extension viewcontroller: gmsautocompleteviewcontrollerdelegate {      // handle user's selection.     func viewcontroller(_ viewcontroller: gmsautocompleteviewcontroller, didautocompletewith place: gmsplace) {         print("place name: \(place.name)")         print("place address: \(place.formattedaddress)")         print("place attributions: \(place.attributions)")         dismiss(animated: true, completion: nil)     }      func viewcontroller(_ viewcontroller: gmsautocompleteviewcontroller, didfailautocompletewitherror error: error) {         // todo: handle error.         print("error: ", error.localizeddescription)     }      // user canceled operation.     func wascancelled(_ viewcontroller: gmsautocompleteviewcontroller) {         dismiss(animated: true, completion: nil)     }      // turn network activity indicator on , off again.     func didrequestautocompletepredictions(_ viewcontroller: gmsautocompleteviewcontroller) {         uiapplication.shared.isnetworkactivityindicatorvisible = true     }      func didupdateautocompletepredictions(_ viewcontroller: gmsautocompleteviewcontroller) {         uiapplication.shared.isnetworkactivityindicatorvisible = false     }  } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -