The latitude, longitude, and course information reported by the system.


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.

Typically, you do not create instances of this class yourself. A CLLocationManager object delivers location objects to its delegate as part of the normal location update process. You can also retrieve the most recent location object from the location property of the location manager itself. 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.


Getting the 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, measured 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 (measured 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, measured in meters per second.

var course: CLLocationDirection

The direction in which the device is traveling.

Data Types

typealias CLLocationSpeed

The velocity (measured in meters per second) at which the device is moving.

typealias CLLocationDirection

An azimuth that is measured in degrees relative to true north.

typealias CLLocationDistance

A distance measurement (measured in meters) from an existing location.

typealias CLLocationAccuracy

The accuracy of a coordinate value, measured in meters.

See Also

Location Updates

Getting the User's Location

Learn how to receive location data in your app.

struct CLLocationCoordinate2D

The latitude and longitude associated with a location, specified using the WGS 84 reference frame.

class CLFloor

The floor of a building on which the user's device is located.

class CLVisit

Information about the user's location during a specific period of time.