LocationManager

open class LocationManager: NSObject, CLLocationManagerDelegate

The LocationManager class is a wrapper around iOS’s built in location subsystem. It provides a simpler interface and customization options.

  • The last received known good location

    Declaration

    Swift

    open var currentLocation: CLLocation?
  • The delegate to receive the location authorization and status callbacks

    Declaration

    Swift

    open weak var delegate: LocationManagerDelegate?
  • Request the user give the application location access at all times.

    Declaration

    Swift

    open func requestAlwaysAuthorization()
  • Request the user give the application location access only when in the foreground.

    Declaration

    Swift

    open func requestWhenInUseAuthorization()
  • Asks the location subsystem if we’re currently authorized for location access while in foreground.

    Declaration

    Swift

    open func isInUseAuthorized() -> Bool

    Return Value

    Whether or not the application is authorized.

  • Asks the location subsystem if we’re currently authorized for location access at all times.

    Declaration

    Swift

    open func isAlwaysAuthorized() -> Bool

    Return Value

    Whether or not the application is authorized.

  • Refreshes the stored current location and also returns it to the caller

    -returns: The most current location the location system has, or nil if it has no current location.

    Declaration

    Swift

    open func refreshCurrentLocation() -> CLLocation?
  • The difference between this function and refreshCurrentLocation() is requestLocation() immediately returns and will serve the location via the delegate

    Declaration

    Swift

    open func requestLocation()
  • Starts the location manager callbacks for location updates

    Declaration

    Swift

    open func startUpdatingLocation()
  • Stops the location manager callbacks

    Declaration

    Swift

    open func stopUpdatingLocation()