CLLocationManagerDelegate
public protocol CLLocationManagerDelegate : AnyObject
The CLLocationManagerDelegate
protocol defines methods that you implement to receive and handle location-related events.
Apple Documentation
-
locationManager(_:
Default implementationdidUpdateLocations: ) 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(_:
Default implementationdidFailWithError: ) 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.
-
locationManager(_:
Default implementationdidChangeAuthorization: ) 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(_:
Default implementationdidUpdateHeading: ) 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.
-
locationManager(_:
Default implementationdidChangeAccuracyAuthorization: ) 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(_:
Default implementationdidEnterRegion: ) 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(_:
Default implementationdidExitRegion: ) 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.
-
locationManager(_:
Default implementationmonitoringDidFailFor: withError: ) 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.
-
locationManager(_:
Default implementationdidStartMonitoringFor: ) 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.
-
locationManager(_:
Default implementationdidDetermineState: for: ) 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.