Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/malekkamel/rxlocation-ios

An RX wrapper for iOS location
https://github.com/malekkamel/rxlocation-ios

cllocationmanager ios location swift xcode

Last synced: about 1 month ago
JSON representation

An RX wrapper for iOS location

Awesome Lists containing this project

README

        

# RxLocation

An RX wrapper for iOS location. It's simple and powerful.

[![Version](https://img.shields.io/cocoapods/v/RxLocation.svg?style=flat)](https://cocoapods.org/pods/RxLocation)
[![License](https://img.shields.io/cocoapods/l/RxLocation.svg?style=flat)](https://cocoapods.org/pods/RxLocation)
[![Platform](https://img.shields.io/cocoapods/p/RxLocation.svg?style=flat)](https://cocoapods.org/pods/RxLocation)

## Usage
#### Choose a persmission
Choose `authorizeWhenInUse` or `authorizeAlways` for permission.

```swift
var rxLocation = RxLocation(authorization: .authorizeAlways)
```

#### Current Location

```swift
var rxLocation = RxLocation(authorization: .authorizeAlways)

rxLocation.requestCurrentLocation()
.subscribe(onNext: { location in
print(location)
})
```

#### Location Updates

```swift

rxLocation.requestLocationUpdates()
.subscribe(onNext: { locations in
print(locations[0])
})
```

#### Stop Updates
To stop updates in case of using `rxLocation.requestLocationUpdates()`
```swift
rxLocation.stopLocationUpdates()

```

#### Location Manager Options
You can set any options for CLLocationManager, for example:

```swift
rxLocation.locationManager.showsBackgroundLocationIndicator = true

```

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Installation

RxLocation is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'RxLocation'
```

## Author

ShabanKamell, [email protected]

## License

RxLocation is available under the Apache license v2.0. See the LICENSE file for more info.