ReactiveCocoa wrapper for CLLocationManager.

Overview

ackee|ReactiveLocation

Build Version License Platform

ReactiveSwift wrapper to observe location

Our wrapper automatically asks for permission. It determines what kind of permission your app requires by checking the Info.plist of your app.

By using our wrapper you can use a single instance of CLLocationManager and it will automatically start and stop updating location based on the number of observers so your app doesn't drain device battery unnecessarily.

Example usage

For example usage you can check our example that is part of this repository.

For simplest cases you are provided a shared instance:

ReactiveLocation.shared.locationProducer().startWithValues { location in
    print(location)
}

If you need more different setups for your CLLocationManager you can create additional instances simply by creating new instances of ReactiveLocation and adding your desired setup to the locationManager which is provided to you (but it's up to you to make sure that the instance is alive as long as you need it):

let reactiveLocation = ReactiveLocation()
reactiveLocation.locationManager.distanceFilter = 100 // do your custom setup
reactiveLocation.locationProducer().startWithValues {
    print($0)
}
// store `reactiveLocation` instance somewhere

Testing support

All features of ReactiveLocation are wrapped into ReactiveLocationService protocol so you should use this protocol as dependency inside your project so you're able to inject any testing implementation you like.

Installation

ReactiveLocation is available through Carthage so adding it to your Cartfile works just fine.

github "AckeeCZ/ReactiveLocation"

If you're not familiar with Carthage, we also support Cocoapods.

pod "ReactiveLocation"

Well if you're not familiar with any dependency manager, you're free to integrate it manually. 😎 But keep in mind that we depend on ReactiveSwift.

Forking this repository

If you use ReactiveLocation in your projects drop us a tweet at @ackeecz or leave a star here on Github. We would love to hear about it!

Sharing is caring

This tool and repo has been opensourced within our #sharingiscaring action when we have decided to opensource our internal projects

Author

Ackee team

License

ReactiveLocation is available under the MIT license. See the LICENSE file for more info.

Comments
  • singleLocation don't ask for permission

    singleLocation don't ask for permission

    Hey 👋 ,

    I did use ReactiveLocation 3.1.1 before, and currently try to move to the master because of the Dependency to ReactiveSwift 6.

    Previously we trigger the permission-request when the location-button of our app was clicked. As with the new version, you cannot explicitly ask for the permission, my approach was to retrieve a singleLocation, but apparently this does not tigger a permission request?

    bug 
    opened by m-ruhl 3
  • Bump tzinfo from 1.2.7 to 1.2.10

    Bump tzinfo from 1.2.7 to 1.2.10

    Bumps tzinfo from 1.2.7 to 1.2.10.

    Release notes

    Sourced from tzinfo's releases.

    v1.2.10

    TZInfo v1.2.10 on RubyGems.org

    v1.2.9

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.

    TZInfo v1.2.9 on RubyGems.org

    v1.2.8

    • Added support for handling "slim" format zoneinfo files that are produced by default by zic version 2020b and later. The POSIX-style TZ string is now used calculate DST transition times after the final defined transition in the file. The 64-bit section is now always used regardless of whether Time has support for 64-bit times. #120.
    • Rubinius is no longer supported.

    TZInfo v1.2.8 on RubyGems.org

    Changelog

    Sourced from tzinfo's changelog.

    Version 1.2.10 - 19-Jul-2022

    Version 1.2.9 - 16-Dec-2020

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.

    Version 1.2.8 - 8-Nov-2020

    • Added support for handling "slim" format zoneinfo files that are produced by default by zic version 2020b and later. The POSIX-style TZ string is now used calculate DST transition times after the final defined transition in the file. The 64-bit section is now always used regardless of whether Time has support for 64-bit times. #120.
    • Rubinius is no longer supported.
    Commits
    • 0814dcd Fix the release date.
    • fd05e2a Preparing v1.2.10.
    • b98c32e Merge branch 'fix-directory-traversal-1.2' into 1.2
    • ac3ee68 Remove unnecessary escaping of + within regex character classes.
    • 9d49bf9 Fix relative path loading tests.
    • 394c381 Remove private_constant for consistency and compatibility.
    • 5e9f990 Exclude Arch Linux's SECURITY file from the time zone index.
    • 17fc9e1 Workaround for 'Permission denied - NUL' errors with JRuby on Windows.
    • 6bd7a51 Update copyright years.
    • 9905ca9 Fix directory traversal in Timezone.get when using Ruby data source
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump cocoapods-downloader from 1.3.0 to 1.6.3

    Bump cocoapods-downloader from 1.3.0 to 1.6.3

    Bumps cocoapods-downloader from 1.3.0 to 1.6.3.

    Release notes

    Sourced from cocoapods-downloader's releases.

    1.6.3

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124

    1.5.1

    Enhancements
    • None.
    Bug Fixes
    • Fix "can't modify frozen string" errors when pods are integrated using the branch option
      buju77 #10920

    1.5.0

    ... (truncated)

    Changelog

    Sourced from cocoapods-downloader's changelog.

    1.6.3 (2022-04-01)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2 (2022-03-28)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1 (2022-03-23)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0 (2022-03-22)

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124

    1.5.1 (2021-09-07)

    Enhancements
    • None.

    ... (truncated)

    Commits
    • c03e2ed Release 1.6.3
    • f75bccc Disable Bazaar tests due to macOS 12.3 not including python2
    • 52a0d54 Merge pull request #128 from CocoaPods/validate_before_dl
    • d27c983 Ensure that the git pre-processor doesn't accidentally bail also
    • 3adfe1f [CHANGELOG] Add empty Master section
    • 591167a Release 1.6.2
    • d2564c3 Merge pull request #127 from CocoaPods/validate_before_dl
    • 99fec61 Switches where we check for invalid input, to move it inside the download fun...
    • 96679f2 [CHANGELOG] Add empty Master section
    • 3a7c54b Release 1.6.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • new release from master

    new release from master

    Hi, I saw that you have migrated to latest ReactiveSwift on master, could you also prepare release? Theres no way to use branch name in podspec dependency section - only version number, and the latest 2.0.1 didn't contain migrated code.

    opened by lukaszspaczynski 1
  • Add producer for single location with timeout

    Add producer for single location with timeout

    Adds singleLocationProducer(timeout:) which returns optional location as it is a frequent case in our apps (#20).

    The producer returns first location received or nil if timeout occurs.

    Checklist

    • [x] Updated CHANGELOG.md.
    opened by olejnjak 0
  • Fix permission requirements

    Fix permission requirements

    This PR addresses #21 issue. ReactiveLocation no longer forces its users to require access to always location permission.

    Checklist

    • [x] Updated CHANGELOG.md.
    opened by olejnjak 0
  • ReactiveLocation always asks for

    ReactiveLocation always asks for "always" permission

    As Apple now requires apps that contain code locationManager.requestAlwaysAuthorization() to have NSLocationAlwaysUsageDescription key in Info.plist, ReactiveLocation forces everyone to contain that key and thus always asks for always permission, because it checks which keys are contained in Info.plist and asks for the highest permission automatically.

    This would need to be changed - @fortmarek suggested that instead of asking for permission directly, we could provide a delegate/closure which would ask the caller to ask for permission himself.

    bug 
    opened by olejnjak 0
  • Add producer with timeout

    Add producer with timeout

    Usual use case is give me location and if it is not available within some time, give me nil. It would be nice to have it implemented inside ReactiveLocation.

    enhancement 
    opened by olejnjak 0
  • New ReactiveLocation

    New ReactiveLocation

    This PR updates ReactiveLocation to better suit our needs.

    • automatically asks for permission if needed
    • monitors location observers and starts/stops location updates when appropriate
    • fits our DI as its methods are no longer static
    • fixes README

    Checklist

    • [x] Updated CHANGELOG.md.
    enhancement 
    opened by olejnjak 0
  • Infinite recursion when running without parameters

    Infinite recursion when running without parameters

    When implementing ReactiveLocationService protocol, we can end up in an infinite recursion. The extension should add only possibility to call e.g. locationProducer() without arguments.

    So we need to remove the default parameter.

    https://github.com/AckeeCZ/ReactiveLocation/blob/0134aa0664505cee84049b6356f0e98ce1383759/ReactiveLocation/ReactiveLocation.swift#L50

    opened by olejnjak 0
  • Migration to Swift 3

    Migration to Swift 3

    Now uses dependency to ReactiveSwift 1.0.0-alpha.1 as it's the only ReactiveSwift version that is available in the Cocoapods master repo. Should be fixed when final version is released.

    opened by olejnjak 0
  • Possible race condition in `observerCount`

    Possible race condition in `observerCount`

    ReactiveLocation contains a possible race condition, locking in observerCount.didSet is not sufficient. Inside synchronised block other thread can mutate the observerCount property and the behaviour might become undefined. Each access to observerCount property should be synchronised.

    https://github.com/AckeeCZ/ReactiveLocation/blob/27939a414c9ac2cdbdf35debd4bfd2c7d4e51196/ReactiveLocation/ReactiveLocation.swift#L34

    bug 
    opened by olejnjak 1
Releases(4.0.2)
Owner
Ackee
Software development enthusiasts from the ❤️ of Europe.
Ackee
An array class implemented in Swift that can be observed using ReactiveCocoa's Signals

ReactiveArray An array class implemented in Swift that can be observed using ReactiveCocoa's Signals. Installation Carthage Add the following to your

Wolox 53 Jan 29, 2022
Set of useful extensions for ReactiveSwift & ReactiveCocoa

ACKReactiveExtensions ACKReactiveExtensions is set of useful extensions for ReactiveCocoa you could use in your apps. Currently we have extensions for

Ackee 17 Aug 12, 2022
A reactive wrapper built around UIImagePickerController.

RxMediaPicker RxMediaPicker is a RxSwift wrapper built around UIImagePickerController consisting in a simple interface for common actions like picking

RxSwift Community 180 Apr 24, 2022
RxSwift wrapper around the elegant HTTP networking in Swift Alamofire

RxAlamofire RxAlamofire is a RxSwift wrapper around the elegant HTTP networking in Swift Alamofire. Getting Started Wrapping RxSwift around Alamofire

RxSwift Community 1.6k Jan 3, 2023
A testable RxSwift wrapper around MultipeerConnectivity

A testable RxSwift wrapper around MultipeerConnectivity RxMultipeer is a RxSwift wrapper for MultipeerConnectivity. Using the adapter pattern, we can

RxSwift Community 69 Jul 5, 2022
RxSwift reactive wrapper for view gestures

RxGesture Usage To run the example project, clone the repo, in the Example folder open RxGesture.xcworkspace. You might need to run pod install from t

RxSwift Community 1.3k Dec 30, 2022
Weather Forecast App (OpenWeather API & CLLocationManager). Clean Swift VIP architecture.

WeatherApp Weather Forecast App (OpenWeather API & CLLocationManager). Clean Swift VIP architecture. Without storyboard or xib. The application shows

Nikita Lomovtsev 7 Dec 25, 2022
Core Data with ReactiveCocoa

ReactiveCoreData ReactiveCoreData (RCD) is an attempt to bring Core Data into the ReactiveCocoa (RAC) world. Currently has several files with the sour

Jacob Gorban 258 Aug 6, 2022
An array class implemented in Swift that can be observed using ReactiveCocoa's Signals

ReactiveArray An array class implemented in Swift that can be observed using ReactiveCocoa's Signals. Installation Carthage Add the following to your

Wolox 53 Jan 29, 2022
Set of useful extensions for ReactiveSwift & ReactiveCocoa

ACKReactiveExtensions ACKReactiveExtensions is set of useful extensions for ReactiveCocoa you could use in your apps. Currently we have extensions for

Ackee 17 Aug 12, 2022
A Swift implementation of a Flickr-search application that uses MVVM and ReactiveCocoa

ReactiveCocoa, Swift and MVVM This application is a Swift-port of an MVVM / ReactiveCocoa example application I wrote a few months ago. Instructions T

Colin Eberhardt 377 Sep 26, 2022
iOS client for Giphy written in Swift with ReactiveCocoa

Giraffe iOS client for Giphy written in Swift with ReactiveCocoa Requirements iOS 10.0 Beta Xcode 8 Beta 2 Swift 2.3 Carthage Why S

Yevhen Dubinin 43 Feb 10, 2022
Type-safe CAAnimation wrapper. It makes preventing to set wrong type values.

TheAnimation TheAnimation is Type-safe CAAnimation wrapper. Introduction For example, if you want to animate backgroundColor with CABasicAnimation, yo

Taiki Suzuki 222 Dec 6, 2022
Swift Reddit API Wrapper

reddift reddift is Swift Reddit API Wrapper framework, and includes a browser is developed using the framework. Supports OAuth2(is not supported on tv

sonson 236 Dec 28, 2022
ModernAVPlayer is a persistence AVPlayer wrapper

ModernAVPlayer is a persistence AVPlayer wrapper ++ Cool features ++ Get 9 nice and relevant player states (playing, buffering, loading

no reason PROJECTS 259 Dec 24, 2022
DataKernel is a minimalistic wrapper around CoreData stack to ease persistence operations.

DataKernel What is DataKernel? DataKernel is a minimalistic wrapper around CoreData stack to ease persistence operations. It is heavily inspired by Su

Denis 16 Jun 2, 2022
SugarRecord is a persistence wrapper designed to make working with persistence solutions like CoreData in a much easier way.

What is SugarRecord? SugarRecord is a persistence wrapper designed to make working with persistence solutions like CoreData in a much easier way. Than

Modo 2.1k Dec 29, 2022
SecureDefaults is a wrapper over UserDefaults/NSUserDefaults with an extra AES-256 encryption layer

SecureDefaults for iOS, macOS Requirements • Usage • Installation • Contributing • Acknowledgments • Contributing • Author • License SecureDefaults is

Victor Peschenkov 216 Dec 22, 2022
A stand-alone Swift wrapper around the mongo-c client library, enabling access to MongoDB servers.

This package is deprecated in favour of the official Mongo Swift Driver. We advise users to switch to that pack

PerfectlySoft Inc. 54 Jul 9, 2022
Perfect - a Swift wrapper around the MySQL client library, enabling access to MySQL database servers.

Perfect - MySQL Connector This project provides a Swift wrapper around the MySQL client library, enabling access to MySQL database servers. This packa

PerfectlySoft Inc. 119 Dec 16, 2022