Non-void return value in void function

985 views Asked by At

How else can I take this variable out of this function so I can send the coordinates to another function. I do not see why this is giving me this error when I try to return the place value.

    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)
    }
0

There are 0 answers