Class

CLLocation

A CLLocation object represents the location data generated by a CLLocationManager object. This object incorporates the geographical coordinates and altitude of the device’s location along with values indicating the accuracy of the measurements and when those measurements were made. In iOS, this class also reports information about the speed and heading in which the device is moving.

Overview

Typically, you use a CLLocationManager object to create instances of this class based on the last known location of the user’s device. You can create instances yourself, however, if you want to cache custom location data or get the distance between two points.

This class is designed to be used as is and should not be subclassed.

Symbols

Location Attributes

var coordinate: CLLocationCoordinate2D

The geographical coordinate information.

var altitude: CLLocationDistance

The altitude measured in meters.

var floor: CLFloor?

The logical floor of the building in which the user is located.

var horizontalAccuracy: CLLocationAccuracy

The radius of uncertainty for the location, measured in meters.

var verticalAccuracy: CLLocationAccuracy

The accuracy of the altitude value in meters.

var timestamp: Date

The time at which this location was determined.

Measuring the Distance Between Coordinates

func distance(from: CLLocation)

Returns the distance (in meters) from the receiver’s location to the specified location.

Getting Speed and Course Information

var speed: CLLocationSpeed

The instantaneous speed of the device in meters per second.

var course: CLLocationDirection

The direction in which the device is traveling.