5
Şu anda, her ülkede sorgular, ama ben bir stackoverflow çözüm How to get country specific result with Google autocomplete place api ios sdk? bulundu SingapurGoogle haritalarında otomatik tamamlama ülkesi nasıl filtrelenir ios sdk?
tek sorguya istiyorum, ama kodu koymak nerde çözemedim.
İşte kod, otomatik tamamlama için tam ekran çözümünü kullanıyorum.
import UIKit
import GoogleMaps
class OnlyLocationViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func clickMe(sender: UIButton) {
let autocompletecontroller = GMSAutocompleteViewController()
autocompletecontroller.delegate = self
self.presentViewController(autocompletecontroller, animated: true, completion: nil)
}
}
extension OnlyLocationViewController: GMSAutocompleteViewControllerDelegate{
func viewController(viewController: GMSAutocompleteViewController, didAutocompleteWithPlace place: GMSPlace) {
print("Place name: ", place.name)
print("Place address: ", place.formattedAddress)
print("Place attributions: ", place.attributions)
self.dismissViewControllerAnimated(true, completion: nil)
}
func viewController(viewController: GMSAutocompleteViewController, didFailAutocompleteWithError error: NSError) {
// To handle error
print(error)
}
func wasCancelled(viewController: GMSAutocompleteViewController) {
self.dismissViewControllerAnimated(true, completion: nil)
}
func didRequestAutocompletePredictions(viewController: GMSAutocompleteViewController) {
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
}
func didUpdateAutocompletePredictions(viewController: GMSAutocompleteViewController) {
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
}
}
Filtre kodunu nereye yerleştirmeliyim?