Latest 1.0.2
Homepage https://github.com/Appmazo/AMZLocationManager
License MIT
Platforms ios 11.0
Authors

CI Status
Version
License
Platform
Beerpay
Beerpay

Example

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

Requirements

iOS 11.0+

Installation

AMZLocationManager is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'AMZLocationManager'

Usage

Setup

let locationManager = AMZLocationManager()

Observe Authorization Status Changes

locationManager.locationAuthorizationUpdatedBlock = { (authorizationStatus) in
    DispatchQueue.main.async { [weak self] in
        self?.tableView.reloadData()
    }
}

Observe Location Changes

locationManager.locationUpdatedBlock = { (location) in
    DispatchQueue.main.async { [weak self] in
        if location != nil { // Don't reload when clearing existing text or it will end editing.
            self?.tableView.reloadData()
        }
    }
}

Properties

isLocationUpdating: Returns true if the locationManager is updating the location. (Read-Only)

currentLocation: Returns the user’s current or custom CLLocation. (Read-Only)

currentAddress: Returns the address for the user’s current or custom CLLocation. (Read-Only)

useCustomLocation: Toggle this property if you want to use a custom location. (i.e. Allowing the user to enter an address)

distanceFilter: Change this property to determine the radius in miles for which a user must move for locations to update. (Default: 1 mile)

desiredAccuracy: Change this property to determine the accuracy for which a user’s location should be tracked. (Default: kCLLocationAccuracyHundredMeters)

Functions

Requests the location always permission using the native iOS prompt.

func requestLocationAlwaysPermission() -> Bool

Requests the location when in use permission using the native iOS prompt.

func requestLocationWhenInUsePermission() -> Bool

Returns true if the user has authorized to use location always or location when in use permissions.

func isLocationsAuthorized() -> Bool

Returns true if the user has authorized to use location always permissions.

func isLocationAuthorizedAlways() -> Bool

Returns true if the user has authorized to use location when in use permission.

func isLocationAuthorizedWhenInUse() -> Bool

Starts monitoring the user’s location if authorized and not using custom location.

func startMonitoringLocation() -> Bool

Updates the current location of the user based on the provided address.

func updateLocation(forAddress address: String?, completion: @escaping (String?, CLLocation?, Error?) -> ())

Author

Appmazo LLC, [email protected]

License

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

Buy Me A Beer?

Beerpay

Latest podspec

{
    "name": "AMZLocationManager",
    "version": "1.0.2",
    "summary": "A simple way to manage a user's location",
    "swift_version": "4.1",
    "description": "AMZLocationManager is a simple way to easily manager a users location within your app.",
    "homepage": "https://github.com/Appmazo/AMZLocationManager",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Appmazo LLC": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Appmazo/AMZLocationManager.git",
        "tag": "1.0.2"
    },
    "social_media_url": "https://twitter.com/appmazo",
    "platforms": {
        "ios": "11.0"
    },
    "source_files": "AMZLocationManager/Classes/**/*.*"
}

Pin It on Pinterest

Share This