Giter Club home page Giter Club logo

position's Introduction

Position is a lightweight location positioning library for iOS.

Build Status Swift Package Manager Pod Version Swift Version GitHub license

Features
“one shot” customizable location requests
🌌 distance and time-based location filtering
🛰 location tracking support
🧭 device heading support
🔒 permission check and response support
🌐 geospatial math utilities
🏙 place data formatting utilities
📊 automatic low-battery location modes
📍 vCard location creation
🔭 multiple component observer-based architecture

Quick Start

Position is available for installation using the Swift Package Manager or the Cocoa dependency manager CocoaPods. Alternatively, you can simply copy the Position source files into your Xcode project.

# CocoaPods
pod "Position", "~> 0.7.0"

# Carthage
github "piemonte/Position" ~> 0.7.0

# SwiftPM
let package = Package(
    dependencies: [
        .Package(url: "https://github.com/piemonte/Position", majorVersion: 0)
    ]
)

Usage

The sample project provides an example of how to integrate Position, otherwise you can follow these steps.

Ensure your app’s Info.plist file includes both a location usage description, required device capability “location-services”, and required background mode (if necessary).

See sample project for examples.

Import the file and setup your component to be a PositionObserver, if you’d like it to be a delegate.

import Position

class ViewController: UIViewController, PositionObserver {
	// ...

Have the component add itself as an observer and configure the appropriate settings.

    override func viewDidLoad() {
        super.viewDidLoad()

        // ...

        Position.shared.addObserver(self)
        Position.shared.distanceFilter = 20

        if Position.shared.locationServicesStatus == .allowedWhenInUse ||
           Position.shared.locationServicesStatus == .allowedAlways {
            Position.shared.performOneShotLocationUpdate(withDesiredAccuracy: 250) { (location, error) -> () in
                print(location, error)
            }
        } else {
            // request permissions based on the type of location support required.
            Position.shared.requestWhenInUseLocationAuthorization()
            // Position.shared.requestAlwaysLocationAuthorization()
        }
    }

Observe delegation, if necessary.

    func position(position: Position, didChangeLocationAuthorizationStatus status: LocationAuthorizationStatus) {
        // location authorization did change, often this may even be triggered on application resume if the user updated settings
    }

Remember when creating location-based apps, respect the privacy of your users and be responsible for how you use their location. This is especially true if your application requires location permission kCLAuthorizationStatusAuthorizedAlways.

To share a location using a vCard, simply call the vCard function on any location object instance.

   let fileURL = location.vCard()

Core Location Additions

Position is bundled with a variety of additions to Core Location, such as geospatial math utilities. For example, one can calculation the direction between two coordinate points enabling directional views and other waypoint representations.

Documentation

You can find the docs here. Documentation is generated with jazzy and hosted on GitHub-Pages.

Community

Resources

License

Position is available under the MIT license, see the LICENSE file for more information.

position's People

Contributors

gizmosachin avatar piemonte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

position's Issues

OSX Support

The location APIs were equivalent last I saw, so I think it would just be a pod spec change required.

How to share my location in the background?

If I want to update my location in the background every 15 minutes for an hour, how would I do so with this library? Would I have my own NSTimer to end it and set the Position.sharedPosition.timeFilter to 15?

EDIT:
How do I update location in the background? The documentation is a bit unclear on how to go about this process. Does oneshot imply only one attempt to update location? What method do I use to update location every time the user moves 40 meters?

EDIT 2:
If I set a distance filter and a time filter, is the time filter to let the singleton know when it expires and the distance filter know when to update the user location?

Carthage error

Hello

I try , Carthage update but gives me;

Dependency "Position" has no shared framework schemes

TY

SwiftLocation vs Position

Congrats Patrick, awesome work =)

What are the strengths over SwiftLocation? Why should I prefer one or the other? I need your wisdom.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.