diff --git a/RxExample/RxExample/Services/GeolocationService.swift b/RxExample/RxExample/Services/GeolocationService.swift index 761a81c0..083400ba 100644 --- a/RxExample/RxExample/Services/GeolocationService.swift +++ b/RxExample/RxExample/Services/GeolocationService.swift @@ -26,13 +26,12 @@ class GeolocationService { locationManager.distanceFilter = kCLDistanceFilterNone; locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; - weak var weakLocationManager = self.locationManager - autorized = Observable.deferred { + autorized = Observable.deferred { [weak locationManager] in let status = CLLocationManager.authorizationStatus() - guard let strongLocationManager = weakLocationManager else { + guard let locationManager = locationManager else { return Observable.just(status) } - return strongLocationManager + return locationManager .rx_didChangeAuthorizationStatus .startWith(status) }