Location services

Location Services can be used to get periodic location updates using Core Location. For more information, see Core Location.

Starting with iOS 11, you must provide a description for how your app uses location services by setting a string for the key NSLocationAlwaysAndWhenInUseUsageDescription in your app's Info.plist file.

If location is only required when app is active.

<string>Location required because...</string>

If the location is always required.

<string>Location always required because...</string>

Features requiring location updates

  • Distance and speed calculation for Time To Collision (TTC) alerts
  • Data collection using Observation library

Configuration modes

There are two variables that provide different configurations of the location services:

  • desiredAccuracy - The level of accuracy to which location information is to be tracked is specified via the desiredAccuracy property of the CLLocationManager object. Also: It is important to remember that when configuring this property to a higher level of accuracy, the greater the drain on the device battery will be. An application should, therefore, never request a greater level of accuracy than is actually needed.

    A number of CoreLocation framework's predefined constant values are available for use when configuring this property.

  • distanceFilter - The default configuration for the location manager is to report updates whenever any changes are detected in the location of the device. The distanceFilter property of the location manager allows applications to specify the amount of distance the device location must change before an update is triggered. If, for example, the distance filter is set to 1000 meters, the application will only receive a location update when the device travels 1000 meters or more from the location of the last update. The distance filter can be cancelled, thereby returning to the default setting, using the kCLDistanceFilterNone constant.


let desiredAccuracy: CLLocationAccuracy = kCLLocationAccuracyBest
LSDLocationManager.shared.setDesiredLocationAccuracy(desiredAccuracy: desiredAccuracy)

let distanceFilter: CLLocationDistance = kCLDistanceFilterNone
LSDLocationManager.shared.setDesiredLocationFilter(distanceFilter: distanceFilter)

Requesting location updates


LSDLocationManager.shared.getLocationUpdates { [unowned self] (location) in

results matching ""

    No results matching ""