I've begun writing a user class that has a method for calculating the user's distance from an object. It looks like this:
class User{
var searchRadius = Int()
var favorites : [String] = []
var photo = String()
var currentLocation = CLLocation()
func calculateDistance(location: CLLocation){
let distance = self.currentLocation.distanceFromLocation(location)*0.000621371
return distance //Error returns on this line
}
}
At the line marked above, I get the following error:
(!) Unexpected non-void return value in void function
I've looked elsewhere for a solution, but can't seem to find anything that applies to this instance. I've used the distanceFromLocation
code elsewhere, and it's worked okay, so I'm not sure what's different about the usage in this case.