Returns the distance (measured in meters) from the receiver’s location to the specified location.
SDKs
- iOS 3.2+
- macOS 10.6+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Core Location
Declaration
func distance(from location: CLLocation) -> CLLocationDistance
Parameters
location
The other location.
Return Value
The distance (in meters) between the two locations.
Discussion
This method measures the distance between the two locations by tracing a line between them that follows the curvature of the Earth. The resulting arc is a smooth curve and does not take into account specific altitude changes between the two locations.