iosswiftgoogle-mapsautocompleteprotocols

ios Swift - API GoogleMaps - not conform protocol GSMAutocompleteViewControllerDelegate


I'm trying to use API GoogleMaps in an ios app to make an auto-completion, but I can't get my hand on the problem, I search for it but it seems I'm the only one to have it.

MyViewController doesn't conform to protocol GSMAutocompleteViewControllerDelegate

class MyViewController: UIViewController {
    
    @IBAction func onLaunchClicked(sender: AnyObject) {
        let acController = GMSAutocompleteViewController()
        acController.delegate = self
        self.presentViewController(acController, animated: true, completion: nil)
    }
}

extension MyViewController: GMSAutocompleteViewControllerDelegate {
    
    func viewController(viewController: GMSAutocompleteViewController!, didAutocompleteWithPlace place: GMSPlace!) {
        // The user has selected a place.
        self.dismissViewControllerAnimated(true, completion: nil)
    }
    
    func viewController(viewController: GMSAutocompleteViewController!, didAutocompleteWithError error: NSError!) {
        self.dismissViewControllerAnimated(true, completion: nil)
    }
    
    func wasCancelled(viewController: GMSAutocompleteViewController!) {
        self.dismissViewControllerAnimated(true, completion: nil)
    }
}

It seems like I don't have all the protocol required, but can't get my hand on it.


Solution

  • Try adding:

    func viewController(viewController: GMSAutocompleteViewController!, didFailAutocompleteWithError error: NSError!) {
    
    }