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
managerThe location manager object that generated the update event.
locationsAn array of
CLLocationobjects 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
managerThe location manager object that generated the error.
errorAn 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
managerThe location manager object reporting the authorization status.
statusThe 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
managerThe location manager object that generated the update event.
newHeadingThe 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
managerThe location manager object reporting the change.
accuracyAuthorizationThe 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
managerThe location manager object that generated the event.
regionThe 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
managerThe location manager object that generated the event.
regionThe 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
managerThe location manager object reporting the error.
regionThe region for which monitoring failed.
errorAn 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
managerThe location manager object that started monitoring the region.
regionThe 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
managerThe location manager object providing this update.
stateThe state of the specified region.
regionThe region whose state was determined.
View on GitHub