CLLocation
The latitude, longitude, and course information reported by the system.
Declaration
class CLLocationMentioned in
Overview
A CLLocation object contains the geographical location and altitude of a device, along with values indicating the accuracy of those measurements and when they were collected. In iOS, a location object also contains course information — that is, the speed and heading in which the device was moving.
Typically, you don’t create location objects yourself. After you request location updates from your CLLocationManager object, the system uses onboard sensors to gather location data and report that data to your app. Some services also return previously collected location data, which you can use as context to improve your services. You can always retrieve the most recently collected location from the location property of your CLLocationManager object. You may create location objects yourself when you want to cache custom location data or calculate the distance between two geographical coordinates.
Use CLLocation objects as-is, and don’t subclass them.
Topics
Creating a location object
init(latitude:longitude:)init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:)init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:speed:timestamp:)init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:)init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:sourceInfo:)
Getting the location attributes
Getting the location accuracy
Measuring the distance between coordinates
Getting speed and course information
speedspeedAccuracycoursecourseAccuracyCLLocationSpeedCLLocationDirectionCLLocationSpeedAccuracyCLLocationDirectionAccuracy