Im following the Google API documentation and attempting to find places around the current device. I am trying to use the GMSPlacesClient.currentPlaceWithCallback.
The documentation example is
GMSPlacesClient.currentPlaceWithCallback({ (placeLikelihoods: GMSPlaceLikelihoodList,error) -> Void in
if error != nil {
println("Current Place error: \(error.localizedDescription)")
return
}
for likelihood in placeLikelihoods.likelihoods {
if let likelihood = likelihood as? GMSPlaceLikelihood {
let place = likelihood.place
println("Current Place name \(place.name) at likelihood \(likelihood.likelihood)")
println("Current Place address \(place.formattedAddress)")
println("Current Place attributions \(place.attributions)")
println("Current PlaceID \(place.placeID)")
}
}
})
However it is failing build with error Cannot invoke 'currentPlaceWithCallback' with an argument list of type '((GMSPlaceLikelihoodList, _) -> Void)'
Suggestions please..Thanks
You can remove the ": GMSPlaceLikelihoodList" after placeLikelihoods and it should work. For all the GMSPlaceClient methods I've worked with, you dont need to include parameter type in the callback