The AGLocationDispatcher framework is a library that provides high-level location management features for iOS apps. It simplifies the process of working with Core Location framework and offers convenient methods to handle location updates, geocoding, and reverse geocoding.


  • Automatic location updates
  • Geocoding and reverse geocoding
  • Real-time location monitoring
  • Background location updates
  • Customizable location accuracy
  • Address formatting


The AGLocationDispatcher framework can be easily installed using CocoaPods, a dependency manager for Swift and Objective-C projects. Follow these steps:

  1. Add the following line to your Podfile:
    pod 'AGLocationDispatcher'
  2. Run the command pod install
  3. Import the framework into your code using:
    import AGLocationDispatcher


To use the AGLocationDispatcher framework in your project, follow the guidelines below:

Setting Up Core Location Usage Description

In order to access location services on iOS, you need to provide a usage description in your app’s Info.plist file. Follow these steps to set it up:

  1. Open your Info.plist file in Xcode.
  2. Add a new row and set the key as NSLocationWhenInUseUsageDescription for foreground location access or NSLocationAlwaysAndWhenInUseUsageDescription for continuous background location access.
  3. Provide a clear and concise description of why your app needs access to user location.

Make sure to request the appropriate authorization from the user before accessing their location.

Requesting Authorization

Before you can start accessing the user’s location, you must request the appropriate authorization. The AGLocationDispatcher framework provides a convenient method for doing this:

AGLocationDispatcher.shared.requestAuthorization(for: .whenInUse) { status in
    // Handle authorization status

Starting Location Updates

The AGLocationDispatcher framework makes it easy to start receiving location updates with the desired accuracy. To start location updates, use the following method:

AGLocationDispatcher.shared.startUpdatingLocation(accuracy: .best) { location, error in
    if let location = location {
        // Handle location update
    } else if let error = error {
        // Handle error

The accuracy parameter specifies the desired level of location accuracy, such as .best or .bestForNavigation.

Stopping Location Updates

To stop receiving location updates, call the stopUpdatingLocation method:


Geocoding and Reverse Geocoding

The AGLocationDispatcher framework provides methods for geocoding and reverse geocoding:

AGLocationDispatcher.shared.geocodeAddressString("Apple Inc, Cupertino") { placemark, error in
    if let placemark = placemark {
        // Handle geocoding result
    } else if let error = error {
        // Handle error

// Reverse Geocoding
let location = CLLocation(latitude: 37.3317, longitude: -122.0307)
AGLocationDispatcher.shared.reverseGeocodeLocation(location) { placemark, error in
    if let placemark = placemark {
        // Handle reverse geocoding result
    } else if let error = error {
        // Handle error

Monitoring Significant Location Changes

You can monitor significant location changes using the AGLocationDispatcher framework:

AGLocationDispatcher.shared.startMonitoringSignificantLocationChanges { location, error in
    if let location = location {
        // Handle significant location change
    } else if let error = error {
        // Handle error

// Stop monitoring significant location changes


The AGLocationDispatcher framework can be configured to customize its behavior. You can modify the following properties:

  • desiredAccuracy: The desired level of location accuracy
  • allowsBackgroundLocationUpdates: Enables or disables background location updates
  • locationUpdateHandler: A closure to handle location updates
  • errorHandler: A closure to handle location-related errors