Class

CLLocation

A data object containing the latitude, longitude, and course information reported by the system.

Overview

A CLLocation object represents the location data generated by a CLLocation​Manager 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 CLLocation​Manager 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.

Symbols

Location Attributes

var coordinate:​ CLLocation​Coordinate2D

The geographical coordinate information.

var altitude:​ CLLocation​Distance

The altitude measured in meters.

var floor:​ CLFloor?

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

var horizontal​Accuracy:​ CLLocation​Accuracy

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

var vertical​Accuracy:​ CLLocation​Accuracy

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:​ CLLocation​Speed

The instantaneous speed of the device in meters per second.

var course:​ CLLocation​Direction

The direction in which the device is traveling.

Data Types

CLLocation​Speed

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

CLLocation​Direction

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