An RX wrapper for iOS location. It's simple and powerful.
Choose authorizeWhenInUse
or authorizeAlways
for permission.
var rxLocation = RxLocation(authorization: .authorizeAlways)
var rxLocation = RxLocation(authorization: .authorizeAlways)
rxLocation.requestCurrentLocation()
.subscribe(onNext: { location in
print(location)
})
rxLocation.requestLocationUpdates()
.subscribe(onNext: { locations in
print(locations[0])
})
To stop updates in case of using rxLocation.requestLocationUpdates()
rxLocation.stopLocationUpdates()
You can set any options for CLLocationManager, for example:
rxLocation.locationManager.showsBackgroundLocationIndicator = true
To run the example project, clone the repo, and run pod install
from the Example directory first.
RxLocation is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'RxLocation'
ShabanKamell, sh3ban.kamel@gmail.com
RxLocation is available under the Apache license v2.0. See the LICENSE file for more info.