   }
   
 }
+
+
+fileprivate class Delegate: NSObject, CLLocationManagerDelegate {
+  
+  var onNewHeading: ((CLHeading) -> ())? = nil
+  
+  override init() {
+    super.init()
+  }
+  
+  func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) {
+    onNewHeading?(newHeading)
+  }
+  
+}

      return Disposables.create()
    }
  }
  
  public func tryAuthorization() -> Observable<Bool> {
    


public extension Reactive where Base : SGLocationManager {
  
  /// Fetches the user's current location and fires observable
  /// exactly ones, if successful, and then completes.
  ///
  /// The observable can error out, e.g., if permission was
  /// not granted to the device's location services, or if
  /// no location could be fetched within the alloted time.
  ///
  /// - Parameter seconds: Maximum time to give GPS
  /// - Returns: Observable of user's current location; can error out
  public func fetchCurrentLocation(within seconds: TimeInterval) -> Observable<CLLocation> {
    guard base.isAuthorized() else {
      return tryAuthorization().flatMap { authorized -> Observable<CLLocation> in
