AppleLocationProvider

public final class AppleLocationProvider
extension AppleLocationProvider: LocationProvider
extension AppleLocationProvider: HeadingProvider

A location provider based on CoreLocation’s CLLocationManager.

  • Undocumented

    See more

    Declaration

    Swift

    public struct Options : Equatable
  • Location manager options.

    Declaration

    Swift

    public var options: Options { get set }
  • A delegate of location provider.

    Declaration

    Swift

    public weak var delegate: AppleLocationProviderDelegate?
  • A stream of location updates.

    An observer will receive a cached value (if any) upon subscription.

    Note

    When the first observer is added, the underlying CLLocationManager instance will ask for permissions (if needed) and start to produce the location updates. When the last observer is gone it will stop.

    Declaration

    Swift

    public var onLocationUpdate: Signal<[Location]> { get }
  • A stream of heading (compass) updates.

    An observer will receive a cached value (if any) upon subscription.

    Note

    When the first observer is added, the underlying CLLocationManager instance will start to produce the heading updates. When the last observer is gone, it will stop.

    Declaration

    Swift

    public var onHeadingUpdate: Signal<Heading> { get }
  • A latest known location.

    Note

    The location updates only when there is at least one observer of location updates. In general, it’s recommended to observe the location via onLocationUpdate.

    Declaration

    Swift

    public var latestLocation: Location? { get }
  • Initializes the built-in location provider.

    Declaration

    Swift

    public convenience init()
  • Requests permission to temporarily use location services with full accuracy.

    Declaration

    Swift

    @available(iOS 14.0, *)
    public func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String)
  • Returns a latest observed location.

    Declaration

    Swift

    public func getLastObservedLocation() -> Location?
  • Adds a location observer.

    The observer will receive a cached value upon subscription.

    Note

    When the first observer is added, the underlying CLLocationManager instance will ask for permissions (if needed) and start to produce the location updates.

    Declaration

    Swift

    public func addLocationObserver(for observer: LocationObserver)
  • Removes the location observer

    When the last observer is gone, the underlying CLLocationManager it will stop location updates.

    Declaration

    Swift

    public func removeLocationObserver(for observer: LocationObserver)
  • A latest known heading.

    Note

    The heading updates only when there is at least one observer of heading updates.

    Declaration

    Swift

    public var latestHeading: Heading? { get }
  • Adds a heading updates observer.

    An observer will receive a cached value (if any) upon subscription.

    Note

    When the first observer is added, the underlying CLLocationManager instance will start to produce the heading updates.

    Declaration

    Swift

    public func add(headingObserver: HeadingObserver)
  • Removes heading observer.

    When the last observer is gone, the underlying CLLocationManager it will stop heading updates.

    Declaration

    Swift

    public func remove(headingObserver: HeadingObserver)
  • Undocumented

    Declaration

    Swift

    public func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
  • Undocumented

    Declaration

    Swift

    public func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading)
  • Undocumented

    Declaration

    Swift

    public func locationManager(_ manager: CLLocationManager, didFailWithError error: Error)
  • Undocumented

    Declaration

    Swift

    public func locationManagerDidChangeAuthorization(_ manager: CLLocationManager)
  • Undocumented

    Declaration

    Swift

    public func locationManagerShouldDisplayHeadingCalibration(_ manager: CLLocationManager) -> Bool