CLLocationManagerDelegate

public protocol CLLocationManagerDelegate : AnyObject

The CLLocationManagerDelegate protocol defines methods that you implement to receive and handle location-related events. Apple Documentation

  • Tells the delegate that new location data is available.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])

    Parameters

    manager

    The location manager object that generated the update event.

    locations

    An array of CLLocation objects representing the new location data.

  • locationManager(_:didFailWithError:) Default implementation

    Tells the delegate that the location manager was unable to retrieve a location value.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, didFailWithError error: Error)

    Parameters

    manager

    The location manager object that generated the error.

    error

    An error object containing the reason why the location could not be retrieved.

  • Tells the delegate that the authorization status changed for the application.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus)

    Parameters

    manager

    The location manager object reporting the authorization status.

    status

    The new authorization status for the application.

  • locationManager(_:didUpdateHeading:) Default implementation

    Tells the delegate that the heading information was updated.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading)

    Parameters

    manager

    The location manager object that generated the update event.

    newHeading

    The new heading data.

  • Tells the delegate that the device’s location accuracy authorization changed.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, didChangeAccuracyAuthorization accuracyAuthorization: CLAccuracyAuthorization)

    Parameters

    manager

    The location manager object reporting the change.

    accuracyAuthorization

    The new accuracy authorization level.

  • locationManager(_:didEnterRegion:) Default implementation

    Tells the delegate that the user entered the specified region.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion)

    Parameters

    manager

    The location manager object that generated the event.

    region

    The region that was entered.

  • locationManager(_:didExitRegion:) Default implementation

    Tells the delegate that the user left the specified region.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion)

    Parameters

    manager

    The location manager object that generated the event.

    region

    The region that was exited.

  • Tells the delegate that a region monitoring error occurred.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, monitoringDidFailFor region: CLRegion?, withError error: Error)

    Parameters

    manager

    The location manager object reporting the error.

    region

    The region for which monitoring failed.

    error

    An error object containing the reason for the failure.

  • Tells the delegate that monitoring for a region started.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, didStartMonitoringFor region: CLRegion)

    Parameters

    manager

    The location manager object that started monitoring the region.

    region

    The region that is now being monitored.

  • Tells the delegate the state of the specified region.

    Default Implementation

    Declaration

    Swift

    func locationManager(_ manager: CLLocationManager, didDetermineState state: CLRegionState, for region: CLRegion)

    Parameters

    manager

    The location manager object providing this update.

    state

    The state of the specified region.

    region

    The region whose state was determined.