我怎么能从这个函数中取出这个变量,所以我可以将坐标发送到另一个函数。当我尝试返回位置值时,我不明白为什么这会给我这个错误。
placesClient!.currentPlaceWithCallback { (placeLikelihoods, error) -> Void in
guard error == nil else {
print("Current Place error: \(error!.localizedDescription)")
return
}
var place : GMSPlace
if let placeLikelihoods = placeLikelihoods {
for likelihood in placeLikelihoods.likelihoods {
place = likelihood.place
print("Current Place name \(place.name) at likelihood \(likelihood.likelihood)")
print("Current Place address \(place.formattedAddress)")
print("Current Place attributions \(place.attributions)")
print("Current PlaceID \(place.placeID)")
}
}
return (place)
}