我怎么能把这个变量从这个函数中取出,以便我可以将坐标发送到另一个函数。当我尝试返回位置值时,我不明白为什么这会给我这个错误。
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)
}