CLLocationManager
open class CLLocationManager : NSObject
The object you use to start and stop the delivery of location-related events to your app. Apple Documentation
-
The delegate object to receive update events. Apple Documentation
Declaration
Swift
open weak var delegate: (any CLLocationManagerDelegate)? -
The current authorization status for the app. Apple Documentation
Declaration
Swift
open var authorizationStatus: CLAuthorizationStatus -
The level of location accuracy the app has permission to use. Apple Documentation
Declaration
Swift
open private(set) var accuracyAuthorization: CLAccuracyAuthorization { get } -
Indicates whether a widget is eligible to receive location updates. Apple Documentation
Declaration
Swift
open private(set) var isAuthorizedForWidgetUpdates: Bool { get }
-
The type of activity the app expects the user to perform during location updates. Apple Documentation
Declaration
Swift
open var activityType: CLActivityType -
The minimum distance (measured in meters) a device must move before an update event is generated.
Note
Set tokCLDistanceFilterNoneto disable distance filtering and receive all location updates. Values less than or equal to 0 disable the filter. Default is 10.0 meters. Apple DocumentationDeclaration
Swift
open var distanceFilter: CLLocationDistance { get set } -
The accuracy of the location data that your app wants to receive. Apple Documentation
Declaration
Swift
open var desiredAccuracy: CLLocationAccuracy -
A Boolean value that indicates whether the location manager may pause location updates. Apple Documentation
Declaration
Swift
open var pausesLocationUpdatesAutomatically: Bool { get set } -
A Boolean value that indicates whether the app receives location updates when running in the background. Apple Documentation
Declaration
Swift
open var allowsBackgroundLocationUpdates: Bool { get set }
-
The most recently retrieved user location. Apple Documentation
Declaration
Swift
open private(set) var location: CLLocation? { get } -
The minimum angular change (measured in degrees) required to generate new heading events. Apple Documentation
Declaration
Swift
open var headingFilter: CLLocationDegrees -
The device orientation to use when computing heading values. Apple Documentation
Declaration
Swift
open var headingOrientation: CLDeviceOrientation -
The most recently reported heading. Apple Documentation
Declaration
Swift
open private(set) var heading: CLHeading? { get }
-
The largest boundary distance that can be assigned to a region. Apple Documentation
Declaration
Swift
open var maximumRegionMonitoringDistance: CLLocationDistance -
The set of shared regions monitored by all location-manager objects. Apple Documentation
Declaration
Swift
open private(set) var monitoredRegions: Set<CLRegion> { get } -
The set of beacon constraints currently being tracked using ranging. Apple Documentation
Declaration
Swift
open private(set) var rangedBeaconConstraints: Set<CLBeaconIdentityConstraint> { get }
-
Undocumented
Declaration
Swift
public override init()
-
Undocumented
Declaration
Swift
open func requestWhenInUseAuthorization() -
Undocumented
Declaration
Swift
open func requestAlwaysAuthorization() -
Undocumented
Declaration
Swift
open func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String, completion: ((Error?) -> Void)? = nil)
-
Starts the generation of updates that report the user’s current location. Apple Documentation
- Calls
requestLocation(with:)at provider-defined intervals (poolInterval).
Declaration
Swift
open func startUpdatingLocation() - Calls
-
Stops all location updates Apple Documentation
Declaration
Swift
open func stopUpdatingLocation() -
Requests the one-time delivery of the user’s current location. Apple Documentation
Declaration
Swift
open func requestLocation()
-
Starts the generation of updates that report the user’s current heading.
Note
Heading updates require magnetometer hardware which is not available on Linux. This method is a no-op on Linux platforms and will not generate heading updates. UseheadingAvailable()to check if heading services are available. Apple DocumentationDeclaration
Swift
open func startUpdatingHeading() -
Stops the generation of heading updates.
Note
This method is a no-op on Linux platforms since heading updates are not supported. Apple DocumentationDeclaration
Swift
open func stopUpdatingHeading()
-
Starts monitoring the specified region for entry and exit events.
Note
The region’snotifyOnEntryandnotifyOnExitproperties determine which events are reported. Apple DocumentationDeclaration
Swift
open func startMonitoring(for region: CLRegion)Parameters
regionThe region to monitor. Only CLCircularRegion is supported.
-
Stops monitoring the specified region.
Declaration
Swift
open func stopMonitoring(for region: CLRegion)Parameters
regionThe region to stop monitoring. Apple Documentation
-
Requests the current state of the specified region.
Note
This method triggers thelocationManager(_:didDetermineState:for:)delegate method. Apple DocumentationDeclaration
Swift
open func requestState(for region: CLRegion)Parameters
regionThe region whose state you want to determine.
-
Returns a Boolean value indicating whether location services are enabled on the device.
Declaration
Swift
open class func locationServicesEnabled() -> Bool -
Returns a Boolean value indicating whether the location manager is able to generate heading-related events.
Declaration
Swift
open class func headingAvailable() -> BoolReturn Value
Always returns
falseon Linux platforms as magnetometer hardware is not available. Apple Documentation -
Returns a Boolean value indicating whether the significant-change location service is available on the device.
Declaration
Swift
open class func significantLocationChangeMonitoringAvailable() -> BoolReturn Value
Always returns
falseon Linux platforms as this service requires OS-level support not available on Linux. Apple Documentation -
Returns a Boolean value indicating whether the device supports region monitoring using the specified class.
Declaration
Swift
open class func isMonitoringAvailable(for regionClass: AnyClass) -> BoolParameters
regionClassThe class of region to check support for.
Return Value
Returns
truefor CLCircularRegion,falsefor other region types as only circular regions are supported in OpenCoreLocation. Apple Documentation -
Returns a Boolean value indicating whether the device supports ranging of beacons that use the iBeacon protocol.
Declaration
Swift
open class func isRangingAvailable() -> BoolReturn Value
Always returns
falseon Linux platforms as beacon ranging requires Bluetooth LE hardware integration. Apple Documentation
View on GitHub