corelocation

package
v0.6.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package corelocation provides Go bindings for the CoreLocation framework.

Obtain the geographic location and orientation of a device.

Core Location provides services that determine a device’s geographic location, altitude, and orientation, or its position relative to a nearby iBeacon device. The framework gathers data using all available components on the device, including the Wi-Fi, GPS, Bluetooth, magnetometer, barometer, and cellular hardware.

Essentials

Authorization

Monitoring

Location updates

Region monitoring

iBeacon

Compass headings

Geocoding

Location push service extension

Errors

Protocols

Enumerations

Key Types

  • CLLocationManager - The object you use to start and stop the delivery of location-related events to your app.
  • CLLocation - The latitude, longitude, and course information reported by the system.
  • CLMonitoringEvent - The object that the framework passes to the monitor’s callback handler upon receiving an event.
  • CLUpdate - An object that represents a location update.
  • CLBeacon - Information about an observed iBeacon device and its relative distance to a person’s device.
  • CLHeading - The orientation of the user’s device, relative to true or magnetic north.
  • CLMonitor - An object that monitors the conditions you add to it.
  • CLBeaconIdentityCondition - A condition that describes the identity characteristics of a beacon.
  • CLLocationUpdater - An object that provides device location updates.
  • CLVisit - Information about the user’s location during a specific period of time.

Code generated from Apple documentation. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var (
	// CLLocationDistanceMax is a constant indicating the maximum distance.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/CLLocationDistanceMax
	CLLocationDistanceMax CLLocationDistance
	// KCLDistanceFilterNone is a constant indicating that all movement should be reported.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLDistanceFilterNone
	KCLDistanceFilterNone CLLocationDistance
	// KCLHeadingFilterNone is a constant indicating that all header values should be reported.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLHeadingFilterNone
	KCLHeadingFilterNone CLLocationDegrees
	// KCLLocationAccuracyBest is the best level of accuracy available.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLLocationAccuracyBest
	KCLLocationAccuracyBest CLLocationAccuracy
	// KCLLocationAccuracyBestForNavigation is the highest possible accuracy that uses additional sensor data to facilitate navigation apps.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLLocationAccuracyBestForNavigation
	KCLLocationAccuracyBestForNavigation CLLocationAccuracy
	// KCLLocationAccuracyHundredMeters is accurate to within one hundred meters.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLLocationAccuracyHundredMeters
	KCLLocationAccuracyHundredMeters CLLocationAccuracy
	// KCLLocationAccuracyKilometer is accurate to the nearest kilometer.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLLocationAccuracyKilometer
	KCLLocationAccuracyKilometer CLLocationAccuracy
	// KCLLocationAccuracyNearestTenMeters is accurate to within ten meters of the desired target.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLLocationAccuracyNearestTenMeters
	KCLLocationAccuracyNearestTenMeters CLLocationAccuracy
	// KCLLocationAccuracyReduced is the level of accuracy used when an app isn’t authorized for full accuracy location data.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLLocationAccuracyReduced
	KCLLocationAccuracyReduced CLLocationAccuracy
	// KCLLocationAccuracyThreeKilometers is accurate to the nearest three kilometers.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLLocationAccuracyThreeKilometers
	KCLLocationAccuracyThreeKilometers CLLocationAccuracy
)
View Source
var (
	// KCLErrorDomain is the domain for Core Location errors.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLErrorDomain
	KCLErrorDomain string
	// KCLErrorUserInfoAlternateRegionKey is a key in the user information dictionary of an error relating to a delayed region-monitoring response.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLErrorUserInfoAlternateRegionKey
	KCLErrorUserInfoAlternateRegionKey string
)
View Source
var (
	// CLTimeIntervalMax is a value representing an unlimited amount of time.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/CLTimeIntervalMax
	CLTimeIntervalMax foundation.NSTimeInterval
)

Functions

func CLLocationCoordinate2DIsValid

func CLLocationCoordinate2DIsValid(coord CLLocationCoordinate2D) bool

CLLocationCoordinate2DIsValid returns a Boolean value indicating whether the specified coordinate is valid.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationCoordinate2DIsValid(_:)

func NewCLLocationArrayErrorBlock

func NewCLLocationArrayErrorBlock(handler CLLocationArrayErrorHandler) (objc.ID, func())

NewCLLocationArrayErrorBlock wraps a Go CLLocationArrayErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

  • [CLLocationManager.RequestHistoricalLocationsWithPurposeKeySampleCountCompletionHandler]

func NewCLMonitorBlock

func NewCLMonitorBlock(handler CLMonitorHandler) (objc.ID, func())

NewCLMonitorBlock wraps a Go CLMonitorHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

  • [CLMonitor.RequestMonitorWithConfigurationCompletion]

func NewCLMonitorCLMonitoringEventBlock

func NewCLMonitorCLMonitoringEventBlock(handler CLMonitorCLMonitoringEventHandler) (objc.ID, func())

NewCLMonitorCLMonitoringEventBlock wraps a Go CLMonitorCLMonitoringEventHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

  • [CLMonitorConfiguration.ConfigWithMonitorNameQueueEventHandler]

func NewCLPlacemarkArrayErrorBlock

func NewCLPlacemarkArrayErrorBlock(handler CLPlacemarkArrayErrorHandler) (objc.ID, func())

NewCLPlacemarkArrayErrorBlock wraps a Go CLPlacemarkArrayErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

  • [CLGeocoder.GeocodeAddressStringCompletionHandler]
  • [CLGeocoder.GeocodeAddressStringInRegionCenteredAtInRegionRadiusPreferredLocaleCompletionHandler]
  • [CLGeocoder.GeocodeAddressStringInRegionCompletionHandler]
  • [CLGeocoder.GeocodeAddressStringInRegionPreferredLocaleCompletionHandler]
  • [CLGeocoder.GeocodePostalAddressCompletionHandler]
  • [CLGeocoder.GeocodePostalAddressPreferredLocaleCompletionHandler]
  • [CLGeocoder.ReverseGeocodeLocationCompletionHandler]
  • [CLGeocoder.ReverseGeocodeLocationPreferredLocaleCompletionHandler]

func NewCLUpdateBlock

func NewCLUpdateBlock(handler CLUpdateHandler) (objc.ID, func())

NewCLUpdateBlock wraps a Go CLUpdateHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

  • [CLLocationUpdater.LiveUpdaterWithConfigurationQueueHandler]
  • [CLLocationUpdater.LiveUpdaterWithQueueHandler]

func NewDataErrorBlock

func NewDataErrorBlock(handler DataErrorHandler) (objc.ID, func())

NewDataErrorBlock wraps a Go DataErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

  • [CLLocationManager.StartMonitoringLocationPushesWithCompletion]

func NewErrorBlock

func NewErrorBlock(handler ErrorHandler) (objc.ID, func())

NewErrorBlock wraps a Go ErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

Types

type CLAccuracyAuthorization

type CLAccuracyAuthorization int

See: https://developer.apple.com/documentation/CoreLocation/CLAccuracyAuthorization

const (
	// CLAccuracyAuthorizationFullAccuracy: The user authorized the app to access location data with full accuracy.
	CLAccuracyAuthorizationFullAccuracy CLAccuracyAuthorization = 0
	// CLAccuracyAuthorizationReducedAccuracy: The user authorized the app to access location data with reduced accuracy.
	CLAccuracyAuthorizationReducedAccuracy CLAccuracyAuthorization = 1
)

func (CLAccuracyAuthorization) String

func (e CLAccuracyAuthorization) String() string

type CLActivityType

type CLActivityType int

See: https://developer.apple.com/documentation/CoreLocation/CLActivityType

const (
	// CLActivityTypeAirborne: The value that indicates activities in the air.
	CLActivityTypeAirborne CLActivityType = 5
	// CLActivityTypeAutomotiveNavigation: The value that indicates positioning in an automobile following a road network.
	CLActivityTypeAutomotiveNavigation CLActivityType = 2
	// CLActivityTypeFitness: The value that indicates positioning during dedicated fitness sessions, such as walking workouts, running workouts, cycling workouts, and so on.
	CLActivityTypeFitness CLActivityType = 3
	// CLActivityTypeOther: The value that indicates the app is using location manager for an unspecified activity.
	CLActivityTypeOther CLActivityType = 1
	// CLActivityTypeOtherNavigation: The value that indicates positioning for activities that don’t or may not adhere to roads such as cycling, scooters, trains, boats and off-road vehicles.
	CLActivityTypeOtherNavigation CLActivityType = 4
)

func (CLActivityType) String

func (e CLActivityType) String() string

type CLAuthorizationStatus

type CLAuthorizationStatus int32

See: https://developer.apple.com/documentation/CoreLocation/CLAuthorizationStatus

const (
	// KCLAuthorizationStatusAuthorizedAlways: The user authorized the app to start location services at any time.
	KCLAuthorizationStatusAuthorizedAlways CLAuthorizationStatus = 3
	// KCLAuthorizationStatusAuthorizedWhenInUse: The user authorized the app to start location services while it is in use.
	KCLAuthorizationStatusAuthorizedWhenInUse CLAuthorizationStatus = 4
	// KCLAuthorizationStatusDenied: The user denied the use of location services for the app or they are disabled globally in Settings.
	KCLAuthorizationStatusDenied CLAuthorizationStatus = 2
	// KCLAuthorizationStatusNotDetermined: The user has not chosen whether the app can use location services.
	KCLAuthorizationStatusNotDetermined CLAuthorizationStatus = 0
	// KCLAuthorizationStatusRestricted: The app is not authorized to use location services.
	KCLAuthorizationStatusRestricted CLAuthorizationStatus = 1
	// Deprecated.
	KCLAuthorizationStatusAuthorized CLAuthorizationStatus = 3
)

func (CLAuthorizationStatus) String

func (e CLAuthorizationStatus) String() string

type CLBeacon

type CLBeacon struct {
	objectivec.Object
}

Information about an observed iBeacon device and its relative distance to a person’s device.

Overview

The CLBeacon class represents a beacon that was observed during beacon ranging. You do not create instances of this class directly. The location manager (CLLocationManager) object reports observed beacons to its associated delegate object.

The identity of a beacon is defined by its CLBeacon.UUID, CLBeacon.Major, and CLBeacon.Minor properties. These values are coded into the beacon itself. For a more thorough description of the meaning of those values, see CLBeaconRegion.

Getting the beacon identity

Determining the distance to the beacon

Getting the observation timestamp

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLBeacon

func CLBeaconFromID

func CLBeaconFromID(id objc.ID) CLBeacon

CLBeaconFromID constructs a CLBeacon from an objc.ID.

Information about an observed iBeacon device and its relative distance to a person’s device.

func NewCLBeacon

func NewCLBeacon() CLBeacon

NewCLBeacon creates a new CLBeacon instance.

func (CLBeacon) Accuracy

func (b CLBeacon) Accuracy() CLLocationAccuracy

The accuracy of the proximity value, measured in meters from the beacon.

Discussion

A beacon with a smaller value for accuracy is typically nearer than a beacon with a larger accuracy value.

Use this property to differentiate between beacons with the same proximity value. Do not use it to identify a precise location for the beacon. Accuracy values may fluctuate due to RF interference.

A negative value in this property signifies that the actual accuracy could not be determined.

See: https://developer.apple.com/documentation/CoreLocation/CLBeacon/accuracy

func (CLBeacon) Autorelease

func (b CLBeacon) Autorelease() CLBeacon

Autorelease adds the receiver to the current autorelease pool.

func (CLBeacon) EncodeWithCoder

func (b CLBeacon) EncodeWithCoder(coder foundation.INSCoder)

func (CLBeacon) Init

func (b CLBeacon) Init() CLBeacon

Init initializes the instance.

func (CLBeacon) Major

func (b CLBeacon) Major() foundation.NSNumber

The major value that the observed beacon transmitted.

See: https://developer.apple.com/documentation/CoreLocation/CLBeacon/major

func (CLBeacon) Minor

func (b CLBeacon) Minor() foundation.NSNumber

The minor value that the observed beacon transmitted.

See: https://developer.apple.com/documentation/CoreLocation/CLBeacon/minor

func (CLBeacon) Proximity

func (b CLBeacon) Proximity() CLProximity

The relative distance to the beacon.

Discussion

The value in this property gives a general sense of the relative distance to the beacon. Use it to quickly identify beacons that are nearer to the user rather than farther away.

See: https://developer.apple.com/documentation/CoreLocation/CLBeacon/proximity

func (CLBeacon) Rssi

func (b CLBeacon) Rssi() int

The received signal strength of the beacon, measured in decibels.

Discussion

This value is the average signal strength of the samples received since Core Location last reported the range of the beacon to your app.

Use this value for calibrating beacon transmission power.

See: https://developer.apple.com/documentation/CoreLocation/CLBeacon/rssi

func (CLBeacon) Timestamp

func (b CLBeacon) Timestamp() foundation.NSDate

A timestamp representing when the beacon was observed.

See: https://developer.apple.com/documentation/CoreLocation/CLBeacon/timestamp

func (CLBeacon) UUID

func (b CLBeacon) UUID() foundation.NSUUID

The UUID that the observed beacon transmitted.

Discussion

The UUID is the most significant beacon identity characteristic. Multiple beacon can transmit the same UUID.

See: https://developer.apple.com/documentation/CoreLocation/CLBeacon/uuid

type CLBeaconClass

type CLBeaconClass struct {
	// contains filtered or unexported fields
}

func GetCLBeaconClass

func GetCLBeaconClass() CLBeaconClass

GetCLBeaconClass returns the class object for CLBeacon.

func (CLBeaconClass) Alloc

func (cc CLBeaconClass) Alloc() CLBeacon

Alloc allocates memory for a new instance of the class.

func (CLBeaconClass) Class

func (cc CLBeaconClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLBeaconIdentityCondition

type CLBeaconIdentityCondition struct {
	CLCondition
}

A condition that describes the identity characteristics of a beacon.

Overview

Core Location defines a beacon identity by UUID, and major and minor values. You need to specify the UUID. If you only specify a UUID, the framework treats the major and minor values as wildcards and any beacons with the same UUID satisfy the condition. Similarly, if you specify only a UUID and a major value, the framework treats the minor value as a wildcard and any beacons with the same UUID and major value satisfy the condition.

Creating beacon identity conditions

Accessing the beacon’s properties

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition

func CLBeaconIdentityConditionFromID

func CLBeaconIdentityConditionFromID(id objc.ID) CLBeaconIdentityCondition

CLBeaconIdentityConditionFromID constructs a CLBeaconIdentityCondition from an objc.ID.

A condition that describes the identity characteristics of a beacon.

func NewBeaconIdentityConditionWithUUID

func NewBeaconIdentityConditionWithUUID(uuid foundation.NSUUID) CLBeaconIdentityCondition

Creates a new beacon identity condition with the identifier you specify.

uuid: A CLBeaconIdentityCondition.UUID to use as the beacon’s identifier.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/initWithUUID:

func NewBeaconIdentityConditionWithUUIDMajor

func NewBeaconIdentityConditionWithUUIDMajor(uuid foundation.NSUUID, major CLBeaconMajorValue) CLBeaconIdentityCondition

Creates a new beacon identity condition with the identifier and major value you specify.

uuid: A CLBeaconIdentityCondition.UUID to use as the beacon’s identifier.

major: A CLBeaconMajorValue to use as the beacon’s major value.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/initWithUUID:major:

func NewBeaconIdentityConditionWithUUIDMajorMinor

func NewBeaconIdentityConditionWithUUIDMajorMinor(uuid foundation.NSUUID, major CLBeaconMajorValue, minor CLBeaconMinorValue) CLBeaconIdentityCondition

Creates a new beacon identity condition with the identifier, and major and minor values you specify.

uuid: A CLBeaconIdentityCondition.UUID to use as the beacon’s identifier.

major: A CLBeaconMajorValue to use as the beacon’s major value.

minor: A CLBeaconMinorValue to use as the beacon’s minor value.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/initWithUUID:major:minor:

func NewCLBeaconIdentityCondition

func NewCLBeaconIdentityCondition() CLBeaconIdentityCondition

NewCLBeaconIdentityCondition creates a new CLBeaconIdentityCondition instance.

func (CLBeaconIdentityCondition) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (CLBeaconIdentityCondition) Init

Init initializes the instance.

func (CLBeaconIdentityCondition) InitWithUUID

Creates a new beacon identity condition with the identifier you specify.

uuid: A CLBeaconIdentityCondition.UUID to use as the beacon’s identifier.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/initWithUUID:

func (CLBeaconIdentityCondition) InitWithUUIDMajor

Creates a new beacon identity condition with the identifier and major value you specify.

uuid: A CLBeaconIdentityCondition.UUID to use as the beacon’s identifier.

major: A CLBeaconMajorValue to use as the beacon’s major value.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/initWithUUID:major:

func (CLBeaconIdentityCondition) InitWithUUIDMajorMinor

Creates a new beacon identity condition with the identifier, and major and minor values you specify.

uuid: A CLBeaconIdentityCondition.UUID to use as the beacon’s identifier.

major: A CLBeaconMajorValue to use as the beacon’s major value.

minor: A CLBeaconMinorValue to use as the beacon’s minor value.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/initWithUUID:major:minor:

func (CLBeaconIdentityCondition) Major

The most significant value associated with the beacon.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/major

func (CLBeaconIdentityCondition) Minor

The least significant value associated with the beacon.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/minor

func (CLBeaconIdentityCondition) UUID

A universally unique identifier that represent the beacon’s identifier.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/UUID

type CLBeaconIdentityConditionClass

type CLBeaconIdentityConditionClass struct {
	// contains filtered or unexported fields
}

func GetCLBeaconIdentityConditionClass

func GetCLBeaconIdentityConditionClass() CLBeaconIdentityConditionClass

GetCLBeaconIdentityConditionClass returns the class object for CLBeaconIdentityCondition.

func (CLBeaconIdentityConditionClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLBeaconIdentityConditionClass) Class

Class returns the underlying Objective-C class pointer.

type CLBeaconIdentityConstraint

type CLBeaconIdentityConstraint struct {
	CLBeaconIdentityCondition
}

Identity characteristics that can match one or more beacons.

Overview

A constraint specifies beacon identity characteristics. Use constraints to check for matching beacons by comparing the beacon’s identity characteristics (CLBeacon.UUID, CLBeacon.Major, and CLBeacon.Minor) to those in the constraint.

Constraints always specify a UUID value, but the major and minor values are optional. A beacon satisfies the constraint if all three identity characteristics of the beacon match the same characteristic of the constraint. Major and minor characteristics are wildcards if they have no value. A major or minor wildcard value matches any value in the beacon’s corresponding characteristic.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityConstraint

func CLBeaconIdentityConstraintFromID

func CLBeaconIdentityConstraintFromID(id objc.ID) CLBeaconIdentityConstraint

CLBeaconIdentityConstraintFromID constructs a CLBeaconIdentityConstraint from an objc.ID.

Identity characteristics that can match one or more beacons.

func NewBeaconIdentityConstraintWithUUID

func NewBeaconIdentityConstraintWithUUID(uuid foundation.NSUUID) CLBeaconIdentityConstraint

Creates a new beacon identity condition with the identifier you specify.

uuid: A CLBeaconIdentityCondition.UUID to use as the beacon’s identifier.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/initWithUUID:

func NewBeaconIdentityConstraintWithUUIDMajor

func NewBeaconIdentityConstraintWithUUIDMajor(uuid foundation.NSUUID, major CLBeaconMajorValue) CLBeaconIdentityConstraint

Creates a new beacon identity condition with the identifier and major value you specify.

uuid: A CLBeaconIdentityCondition.UUID to use as the beacon’s identifier.

major: A CLBeaconMajorValue to use as the beacon’s major value.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/initWithUUID:major:

func NewBeaconIdentityConstraintWithUUIDMajorMinor

func NewBeaconIdentityConstraintWithUUIDMajorMinor(uuid foundation.NSUUID, major CLBeaconMajorValue, minor CLBeaconMinorValue) CLBeaconIdentityConstraint

Creates a new beacon identity condition with the identifier, and major and minor values you specify.

uuid: A CLBeaconIdentityCondition.UUID to use as the beacon’s identifier.

major: A CLBeaconMajorValue to use as the beacon’s major value.

minor: A CLBeaconMinorValue to use as the beacon’s minor value.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition/initWithUUID:major:minor:

func NewCLBeaconIdentityConstraint

func NewCLBeaconIdentityConstraint() CLBeaconIdentityConstraint

NewCLBeaconIdentityConstraint creates a new CLBeaconIdentityConstraint instance.

func (CLBeaconIdentityConstraint) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (CLBeaconIdentityConstraint) Init

Init initializes the instance.

type CLBeaconIdentityConstraintClass

type CLBeaconIdentityConstraintClass struct {
	// contains filtered or unexported fields
}

func GetCLBeaconIdentityConstraintClass

func GetCLBeaconIdentityConstraintClass() CLBeaconIdentityConstraintClass

GetCLBeaconIdentityConstraintClass returns the class object for CLBeaconIdentityConstraint.

func (CLBeaconIdentityConstraintClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLBeaconIdentityConstraintClass) Class

Class returns the underlying Objective-C class pointer.

type CLBeaconMajorValue

type CLBeaconMajorValue = uint16

CLBeaconMajorValue is the most significant value in a beacon.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconMajorValue

type CLBeaconMinorValue

type CLBeaconMinorValue = uint16

CLBeaconMinorValue is the least significant value in a beacon.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconMinorValue

type CLBeaconRegion

type CLBeaconRegion struct {
	CLRegion
}

A region for detecting the presence of iBeacon devices.

Overview

A CLBeaconRegion object defines a region that you use to detect Bluetooth beacons conforming to the iBeacon specification. In contrast to a CLCircularRegion that centers on a geographic location, a CLBeaconRegion focuses on an iBeacon with specific identifying characteristics, which you provide. When a matching device comes in range, Core Location notifies your app.

You monitor beacon regions in two ways. To detect when a beacon is in range, use the [CLLocationManager.StartMonitoringForRegion] method of your location manager object. After detecting a beacon, call the startRangingBeacons(in:) method to determine the relative distance to that beacon.

When detecting an iBeacon, you need to specify the proximityUUID, major, and minor values that you programmed into the beacon hardware. You use the values to identify your beacons uniquely, and you can specify a subset of values to detect multiple beacons. The proximityUUID property is typically the same for all of the beacons in your installation. Use the major and minor values to distinguish among different beacons in your installation.

If you want to configure the current iOS device as a Bluetooth beacon, create a beacon region with the appropriate identifying information. You can then call the peripheralData(withMeasuredPower:) method of the region to get a dictionary that you can use to advertise the device with the Core Bluetooth framework. For more information about using that framework to advertise the device as a beacon, see Turning an iOS device into an iBeacon device.

For information about how to detect beacons, see Determining the proximity to an iBeacon device.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconRegion

func CLBeaconRegionFromID

func CLBeaconRegionFromID(id objc.ID) CLBeaconRegion

CLBeaconRegionFromID constructs a CLBeaconRegion from an objc.ID.

A region for detecting the presence of iBeacon devices.

func NewCLBeaconRegion

func NewCLBeaconRegion() CLBeaconRegion

NewCLBeaconRegion creates a new CLBeaconRegion instance.

func (CLBeaconRegion) Autorelease

func (b CLBeaconRegion) Autorelease() CLBeaconRegion

Autorelease adds the receiver to the current autorelease pool.

func (CLBeaconRegion) Init

func (b CLBeaconRegion) Init() CLBeaconRegion

Init initializes the instance.

type CLBeaconRegionClass

type CLBeaconRegionClass struct {
	// contains filtered or unexported fields
}

func GetCLBeaconRegionClass

func GetCLBeaconRegionClass() CLBeaconRegionClass

GetCLBeaconRegionClass returns the class object for CLBeaconRegion.

func (CLBeaconRegionClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLBeaconRegionClass) Class

func (cc CLBeaconRegionClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLBodyIdentifiable

type CLBodyIdentifiable interface {
	objectivec.IObject
}

CLBodyIdentifiable protocol.

See: https://developer.apple.com/documentation/CoreLocation/CLBodyIdentifiable

type CLBodyIdentifiableObject

type CLBodyIdentifiableObject struct {
	objectivec.Object
}

CLBodyIdentifiableObject wraps an existing Objective-C object that conforms to the CLBodyIdentifiable protocol.

func CLBodyIdentifiableObjectFromID

func CLBodyIdentifiableObjectFromID(id objc.ID) CLBodyIdentifiableObject

CLBodyIdentifiableObjectFromID constructs a CLBodyIdentifiableObject from an objc.ID. The object is determined to conform to the protocol at runtime.

func (CLBodyIdentifiableObject) BaseObject

type CLCircularGeographicCondition

type CLCircularGeographicCondition struct {
	CLCondition
}

A circular geographic condition that a center point and radius define.

Overview

Use CLCircularGeographicCondition to monitor events that occur in a circular geographic condition that you describe.

Creating a circular geographic condition

Instance properties

See: https://developer.apple.com/documentation/CoreLocation/CLCircularGeographicCondition

func CLCircularGeographicConditionFromID

func CLCircularGeographicConditionFromID(id objc.ID) CLCircularGeographicCondition

CLCircularGeographicConditionFromID constructs a CLCircularGeographicCondition from an objc.ID.

A circular geographic condition that a center point and radius define.

func NewCLCircularGeographicCondition

func NewCLCircularGeographicCondition() CLCircularGeographicCondition

NewCLCircularGeographicCondition creates a new CLCircularGeographicCondition instance.

func NewCircularGeographicConditionWithCenterRadius

func NewCircularGeographicConditionWithCenterRadius(center CLLocationCoordinate2D, radius CLLocationDistance) CLCircularGeographicCondition

Creates a new circular geographic condition with the center point and radius you provide.

center: The center of the circular geographic condition.

radius: The radius of the circular geographic condition.

Return Value

Returns an instance of CLCircularGeographicCondition with the specified center coordinate and radius.

See: https://developer.apple.com/documentation/CoreLocation/CLCircularGeographicCondition/initWithCenter:radius:

func (CLCircularGeographicCondition) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (CLCircularGeographicCondition) Center

The center of the circular geographic condition.

See: https://developer.apple.com/documentation/CoreLocation/CLCircularGeographicCondition/center

func (CLCircularGeographicCondition) Init

Init initializes the instance.

func (CLCircularGeographicCondition) InitWithCenterRadius

Creates a new circular geographic condition with the center point and radius you provide.

center: The center of the circular geographic condition.

radius: The radius of the circular geographic condition.

Return Value

Returns an instance of CLCircularGeographicCondition with the specified center coordinate and radius.

See: https://developer.apple.com/documentation/CoreLocation/CLCircularGeographicCondition/initWithCenter:radius:

func (CLCircularGeographicCondition) Radius

The radius of the circular geographic condition.

See: https://developer.apple.com/documentation/CoreLocation/CLCircularGeographicCondition/radius

type CLCircularGeographicConditionClass

type CLCircularGeographicConditionClass struct {
	// contains filtered or unexported fields
}

func GetCLCircularGeographicConditionClass

func GetCLCircularGeographicConditionClass() CLCircularGeographicConditionClass

GetCLCircularGeographicConditionClass returns the class object for CLCircularGeographicCondition.

func (CLCircularGeographicConditionClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLCircularGeographicConditionClass) Class

Class returns the underlying Objective-C class pointer.

type CLCircularRegion

type CLCircularRegion struct {
	CLRegion
}

A circular geographic region that a center point and radius deine.

Overview

The CLCircularRegion class defines the location and boundaries for a circular geographic region. You can use instances of this class to define geofences for a specific location. The crossing of a geofence’s boundary causes the location manager to notify its delegate.

See: https://developer.apple.com/documentation/CoreLocation/CLCircularRegion

func CLCircularRegionFromID

func CLCircularRegionFromID(id objc.ID) CLCircularRegion

CLCircularRegionFromID constructs a CLCircularRegion from an objc.ID.

A circular geographic region that a center point and radius deine.

func NewCLCircularRegion

func NewCLCircularRegion() CLCircularRegion

NewCLCircularRegion creates a new CLCircularRegion instance.

func (CLCircularRegion) Autorelease

func (c CLCircularRegion) Autorelease() CLCircularRegion

Autorelease adds the receiver to the current autorelease pool.

func (CLCircularRegion) Init

Init initializes the instance.

type CLCircularRegionClass

type CLCircularRegionClass struct {
	// contains filtered or unexported fields
}

func GetCLCircularRegionClass

func GetCLCircularRegionClass() CLCircularRegionClass

GetCLCircularRegionClass returns the class object for CLCircularRegion.

func (CLCircularRegionClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLCircularRegionClass) Class

func (cc CLCircularRegionClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLCondition

type CLCondition struct {
	objectivec.Object
}

The abstract base class that all other conditions derive from.

See: https://developer.apple.com/documentation/CoreLocation/CLCondition-c.class

func CLConditionFromID

func CLConditionFromID(id objc.ID) CLCondition

CLConditionFromID constructs a CLCondition from an objc.ID.

The abstract base class that all other conditions derive from.

func NewCLCondition

func NewCLCondition() CLCondition

NewCLCondition creates a new CLCondition instance.

func (CLCondition) Autorelease

func (c CLCondition) Autorelease() CLCondition

Autorelease adds the receiver to the current autorelease pool.

func (CLCondition) EncodeWithCoder

func (c CLCondition) EncodeWithCoder(coder foundation.INSCoder)

func (CLCondition) Init

func (c CLCondition) Init() CLCondition

Init initializes the instance.

type CLConditionClass

type CLConditionClass struct {
	// contains filtered or unexported fields
}

func GetCLConditionClass

func GetCLConditionClass() CLConditionClass

GetCLConditionClass returns the class object for CLCondition.

func (CLConditionClass) Alloc

func (cc CLConditionClass) Alloc() CLCondition

Alloc allocates memory for a new instance of the class.

func (CLConditionClass) Class

func (cc CLConditionClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLDeviceOrientation

type CLDeviceOrientation int32

See: https://developer.apple.com/documentation/CoreLocation/CLDeviceOrientation

const (
	// CLDeviceOrientationFaceDown: The device is held parallel to the ground with the screen facing downwards.
	CLDeviceOrientationFaceDown CLDeviceOrientation = 6
	// CLDeviceOrientationFaceUp: The device is held parallel to the ground with the screen facing upwards.
	CLDeviceOrientationFaceUp CLDeviceOrientation = 5
	// CLDeviceOrientationLandscapeLeft: The device is in landscape mode, with the device held upright and the home button on the right side.
	CLDeviceOrientationLandscapeLeft CLDeviceOrientation = 3
	// CLDeviceOrientationLandscapeRight: The device is in landscape mode, with the device held upright and the home button on the left side.
	CLDeviceOrientationLandscapeRight CLDeviceOrientation = 4
	// CLDeviceOrientationPortrait: The device is in portrait mode, with the device held upright and the home button at the bottom.
	CLDeviceOrientationPortrait CLDeviceOrientation = 1
	// CLDeviceOrientationPortraitUpsideDown: The device is in portrait mode but upside down, with the device held upright and the home button at the top.
	CLDeviceOrientationPortraitUpsideDown CLDeviceOrientation = 2
	// CLDeviceOrientationUnknown: The orientation is currently not known.
	CLDeviceOrientationUnknown CLDeviceOrientation = 0
)

func (CLDeviceOrientation) String

func (e CLDeviceOrientation) String() string

type CLError

type CLError int

See: https://developer.apple.com/documentation/CoreLocation/CLError-swift.struct/Code

const (
	// KCLErrorDeferredAccuracyTooLow: A constant that indicates deferred mode isn’t supported for the requested accuracy.
	KCLErrorDeferredAccuracyTooLow CLError = 13
	// KCLErrorDeferredCanceled: A constant that indicates your app or the location manager canceled the request for deferred updates.
	KCLErrorDeferredCanceled CLError = 15
	// KCLErrorDeferredDistanceFiltered: A constant that indicates deferred mode doesn’t support distance filters.
	KCLErrorDeferredDistanceFiltered CLError = 14
	// KCLErrorDeferredFailed: A constant that indicates the location manager didn’t enter deferred mode for an unknown reason.
	KCLErrorDeferredFailed CLError = 11
	// KCLErrorDeferredNotUpdatingLocation: A constant that indicates the location manager didn’t enter deferred mode because location updates were already disabled or paused.
	KCLErrorDeferredNotUpdatingLocation CLError = 12
	// KCLErrorDenied: A constant that indicates the user denied access to the location service.
	KCLErrorDenied CLError = 1
	// KCLErrorGeocodeCanceled: A constant that indicates the geocode request was canceled.
	KCLErrorGeocodeCanceled CLError = 10
	// KCLErrorGeocodeFoundNoResult: A constant that indicates the geocode request yielded no result.
	KCLErrorGeocodeFoundNoResult CLError = 8
	// KCLErrorGeocodeFoundPartialResult: A constant that indicates the geocode request yielded a partial result.
	KCLErrorGeocodeFoundPartialResult CLError = 9
	// KCLErrorHeadingFailure: A constant that indicates the location manager can’t determine the heading.
	KCLErrorHeadingFailure          CLError = 3
	KCLErrorHistoricalLocationError CLError = 19
	// KCLErrorLocationUnknown: A constant that indicates the location manager was unable to obtain a location value right now.
	KCLErrorLocationUnknown CLError = 0
	// KCLErrorNetwork: A constant that indicates the network was unavailable or a network error occurred.
	KCLErrorNetwork CLError = 2
	// KCLErrorPromptDeclined: A constant that indicates the user didn’t grant the requested temporary authorization.
	KCLErrorPromptDeclined CLError = 18
	// KCLErrorRangingFailure: A constant that indicates a general ranging error occurred.
	KCLErrorRangingFailure CLError = 17
	// KCLErrorRangingUnavailable: A constant that indicates ranging is disabled.
	KCLErrorRangingUnavailable CLError = 16
	// KCLErrorRegionMonitoringDenied: A constant that indicates the user denied access to the region monitoring service.
	KCLErrorRegionMonitoringDenied CLError = 4
	// KCLErrorRegionMonitoringFailure: A constant that indicates the location manager failed to monitor a registered region.
	KCLErrorRegionMonitoringFailure CLError = 5
	// KCLErrorRegionMonitoringResponseDelayed: A constant that indicates Core Location will deliver events but they may be delayed.
	KCLErrorRegionMonitoringResponseDelayed CLError = 7
	// KCLErrorRegionMonitoringSetupDelayed: A constant that indicates Core Location failed to initialize the region monitoring feature.
	KCLErrorRegionMonitoringSetupDelayed CLError = 6
)

func (CLError) String

func (e CLError) String() string

type CLFloor

type CLFloor struct {
	objectivec.Object
}

The floor of a building on which the user’s device is located.

Overview

A CLFloor object specifies the floor of the building on which the device is located. In places where floor information can be determined, a CLLocation object may include a floor object along with the regular location data.

You do not create instances of this class directly, nor should you subclass it.

Getting the floor level

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLFloor

func CLFloorFromID

func CLFloorFromID(id objc.ID) CLFloor

CLFloorFromID constructs a CLFloor from an objc.ID.

The floor of a building on which the user’s device is located.

func NewCLFloor

func NewCLFloor() CLFloor

NewCLFloor creates a new CLFloor instance.

func (CLFloor) Autorelease

func (f CLFloor) Autorelease() CLFloor

Autorelease adds the receiver to the current autorelease pool.

func (CLFloor) EncodeWithCoder

func (f CLFloor) EncodeWithCoder(coder foundation.INSCoder)

func (CLFloor) Init

func (f CLFloor) Init() CLFloor

Init initializes the instance.

func (CLFloor) Level

func (f CLFloor) Level() int

The logical floor of the building.

Discussion

Level values represent logical levels above or below ground level and are not intended to correspond to any numbering scheme in use by the building itself. The ground floor of a building is always represented by the value `0`. Floors above the ground floor are represented by positive integers, so a value of `1` represents the floor above ground level, a value of `2` represents two floors above ground level, and so on. Floors below the ground floor are represented by corresponding negative integers, with a value of -1 representing the floor immediately below ground level and so on.

It is erroneous to use the user’s level in a building as an estimate of altitude.

See: https://developer.apple.com/documentation/CoreLocation/CLFloor/level

type CLFloorClass

type CLFloorClass struct {
	// contains filtered or unexported fields
}

func GetCLFloorClass

func GetCLFloorClass() CLFloorClass

GetCLFloorClass returns the class object for CLFloor.

func (CLFloorClass) Alloc

func (cc CLFloorClass) Alloc() CLFloor

Alloc allocates memory for a new instance of the class.

func (CLFloorClass) Class

func (cc CLFloorClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLGeocodeCompletionHandler

type CLGeocodeCompletionHandler = func([]CLPlacemark, foundation.NSError)

CLGeocodeCompletionHandler is a block to be called when a geocoding request is complete.

See: https://developer.apple.com/documentation/CoreLocation/CLGeocodeCompletionHandler

type CLGeocoder

type CLGeocoder struct {
	objectivec.Object
}

An interface for converting between geographic coordinates and place names.

Overview

The CLGeocoder class provides services for converting between a coordinate (specified as a latitude and longitude) and the user-friendly representation of that coordinate. A user-friendly representation of the coordinate typically consists of the street, city, state, and country or region information corresponding to the given location, but it may also contain a relevant point of interest, landmarks, or other identifying information. A geocoder object is a single-shot object that works with a network-based service to look up placemark information for its specified coordinate value.

To use a geocoder object, you create it and call one of its forward- or reverse-geocoding methods to begin the request. Reverse-geocoding requests take a latitude and longitude value and find a user-readable address. Forward-geocoding requests take a user-readable address and find the corresponding latitude and longitude value. Forward-geocoding requests may also return additional information about the specified location, such as a point of interest or building at that location. For both types of request, the results are returned using a CLPlacemark object. In the case of forward-geocoding requests, multiple placemark objects may be returned if the provided information yielded multiple possible locations.

To make smart decisions about what types of information to return, the geocoder server uses all the information provided to it when processing the request. For example, if the user is moving quickly along a highway, it might return the name of the overall region, and not the name of a small park that the user is passing through.

Tips for Using a Geocoder Object

Apps must be conscious of how they use geocoding. Geocoding requests are rate-limited for each app, so making too many requests in a short period of time may cause some of the requests to fail. (When the maximum rate is exceeded, the geocoder returns an error object with the KCLErrorNetwork error to the associated completion handler.) Here are some rules of thumb for using this class effectively:

- Send at most one geocoding request for any one user action. - If the user performs multiple actions that involve geocoding the same location, reuse the results from the initial geocoding request instead of starting individual requests for each action. - When you want to update the user’s current location automatically (such as when the user is moving), issue new geocoding requests only when the user has moved a significant distance and after a reasonable amount of time has passed. For example, in a typical situation, you should not send more than one geocoding request per minute. - Do not start a geocoding request at a time when the user will not see the results immediately. For example, do not start a request if your application is inactive or in the background.

The computer or device must have access to the network in order for the geocoder object to return detailed placemark information. Although, the geocoder stores enough information locally to report the localized country or region name and ISO country code for many locations. If this information isn’t available for a specific location, the geocoder may still report an error to your completion block.

You can use geocoder objects either in conjunction with, or independent of, the classes of the MapKit framework.

Managing geocoding requests

  • CLGeocoder.IsGeocoding: A Boolean value indicating whether the receiver is in the middle of geocoding its value.

See: https://developer.apple.com/documentation/CoreLocation/CLGeocoder

func CLGeocoderFromID

func CLGeocoderFromID(id objc.ID) CLGeocoder

CLGeocoderFromID constructs a CLGeocoder from an objc.ID.

An interface for converting between geographic coordinates and place names.

func NewCLGeocoder

func NewCLGeocoder() CLGeocoder

NewCLGeocoder creates a new CLGeocoder instance.

func (CLGeocoder) Autorelease

func (g CLGeocoder) Autorelease() CLGeocoder

Autorelease adds the receiver to the current autorelease pool.

func (CLGeocoder) Init

func (g CLGeocoder) Init() CLGeocoder

Init initializes the instance.

func (CLGeocoder) IsGeocoding

func (g CLGeocoder) IsGeocoding() bool

A Boolean value indicating whether the receiver is in the middle of geocoding its value.

Discussion

This property contains the value true if the process is ongoing or false if the process is done or has not yet been initiated.

See: https://developer.apple.com/documentation/CoreLocation/CLGeocoder/isGeocoding

type CLGeocoderClass

type CLGeocoderClass struct {
	// contains filtered or unexported fields
}

func GetCLGeocoderClass

func GetCLGeocoderClass() CLGeocoderClass

GetCLGeocoderClass returns the class object for CLGeocoder.

func (CLGeocoderClass) Alloc

func (cc CLGeocoderClass) Alloc() CLGeocoder

Alloc allocates memory for a new instance of the class.

func (CLGeocoderClass) Class

func (cc CLGeocoderClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLHeading

type CLHeading struct {
	objectivec.Object
}

The orientation of the user’s device, relative to true or magnetic north.

Overview

A CLHeading object contains computed values for the device’s azimuth (orientation) relative to true or magnetic north. It also includes the raw data for the three-dimensional vector used to compute those values. A navigation app might use the information to rotate a map so that it reflects the direction that the user is facing.

Typically, you don’t create instances of this class yourself, nor do you subclass it. Instead, you receive instances of this class through the delegate assigned to the CLLocationManager object whose CLLocationManager.StartUpdatingHeading method you called.

Getting the heading values

Getting the raw heading data

  • CLHeading.X: The geomagnetic data (measured in microteslas) for the x-axis.
  • CLHeading.Y: The geomagnetic data (measured in microteslas) for the y-axis.
  • CLHeading.Z: The geomagnetic data (measured in microteslas) for the z-axis.

Getting the event timestamp

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLHeading

func CLHeadingFromID

func CLHeadingFromID(id objc.ID) CLHeading

CLHeadingFromID constructs a CLHeading from an objc.ID.

The orientation of the user’s device, relative to true or magnetic north.

func NewCLHeading

func NewCLHeading() CLHeading

NewCLHeading creates a new CLHeading instance.

func (CLHeading) Autorelease

func (h CLHeading) Autorelease() CLHeading

Autorelease adds the receiver to the current autorelease pool.

func (CLHeading) EncodeWithCoder

func (h CLHeading) EncodeWithCoder(coder foundation.INSCoder)

func (CLHeading) HeadingAccuracy

func (h CLHeading) HeadingAccuracy() CLLocationDirection

The maximum deviation (measured in degrees) between the reported heading and the true geomagnetic heading.

Discussion

A positive value in this property represents the potential error between the value reported by the CLHeading.MagneticHeading property and the actual direction of magnetic north. Thus, the lower the value of this property, the more accurate the heading. A negative value means that the reported heading is invalid, which can occur when the device is uncalibrated or there is strong interference from local magnetic fields.

See: https://developer.apple.com/documentation/CoreLocation/CLHeading/headingAccuracy

func (CLHeading) Init

func (h CLHeading) Init() CLHeading

Init initializes the instance.

func (CLHeading) MagneticHeading

func (h CLHeading) MagneticHeading() CLLocationDirection

The heading (measured in degrees) relative to magnetic north.

Discussion

The value in this property represents the heading relative to the magnetic North Pole, which is different from the geographic North Pole. The value `0` means the device is pointed toward magnetic north, `90` means it is pointed east, `180` means it is pointed south, and so on. The value in this property should always be valid.

In iOS 3.x and earlier, the value in this property is always measured relative to the top of the device in a portrait orientation, regardless of the device’s actual physical or interface orientation. In iOS 4.0 and later, the value is measured relative to the heading orientation specified by the location manager. For more information, see the CLLocationManager.HeadingOrientation property in CLLocationManager.

If the CLHeading.HeadingAccuracy property contains a negative value, the value in this property should be considered unreliable.

See: https://developer.apple.com/documentation/CoreLocation/CLHeading/magneticHeading

func (CLHeading) Timestamp

func (h CLHeading) Timestamp() foundation.NSDate

The time at which this heading was determined.

See: https://developer.apple.com/documentation/CoreLocation/CLHeading/timestamp

func (CLHeading) TrueHeading

func (h CLHeading) TrueHeading() CLLocationDirection

The heading (measured in degrees) relative to true north.

Discussion

The value in this property represents the heading relative to the geographic North Pole. The value `0` means the device is pointed toward true north, `90` means it is pointed due east, `180` means it is pointed due south, and so on. A negative value indicates that the heading could not be determined.

In iOS 3.x and earlier, the value in this property is always measured relative to the top of the device in a portrait orientation, regardless of the device’s actual physical or interface orientation. In iOS 4.0 and later, the value is measured relative to the heading orientation specified by the location manager. For more information, see the CLLocationManager.HeadingOrientation property in CLLocationManager.

See: https://developer.apple.com/documentation/CoreLocation/CLHeading/trueHeading

func (CLHeading) X

The geomagnetic data (measured in microteslas) for the x-axis.

Discussion

This value represents the x-axis deviation from the magnetic field lines being tracked by the device.

See: https://developer.apple.com/documentation/CoreLocation/CLHeading/x

func (CLHeading) Y

The geomagnetic data (measured in microteslas) for the y-axis.

Discussion

This value represents the y-axis deviation from the magnetic field lines being tracked by the device.

See: https://developer.apple.com/documentation/CoreLocation/CLHeading/y

func (CLHeading) Z

The geomagnetic data (measured in microteslas) for the z-axis.

Discussion

This value represents the z-axis deviation from the magnetic field lines being tracked by the device.

See: https://developer.apple.com/documentation/CoreLocation/CLHeading/z

type CLHeadingClass

type CLHeadingClass struct {
	// contains filtered or unexported fields
}

func GetCLHeadingClass

func GetCLHeadingClass() CLHeadingClass

GetCLHeadingClass returns the class object for CLHeading.

func (CLHeadingClass) Alloc

func (cc CLHeadingClass) Alloc() CLHeading

Alloc allocates memory for a new instance of the class.

func (CLHeadingClass) Class

func (cc CLHeadingClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLHeadingComponentValue

type CLHeadingComponentValue = float64

CLHeadingComponentValue is a type used to report magnetic differences reported by the onboard hardware.

See: https://developer.apple.com/documentation/CoreLocation/CLHeadingComponentValue

type CLLiveUpdateConfiguration

type CLLiveUpdateConfiguration int

See: https://developer.apple.com/documentation/CoreLocation/CLLiveUpdateConfiguration

const (
	// CLLiveUpdateConfigurationAirborne: A configuration for airborne use cases.
	CLLiveUpdateConfigurationAirborne CLLiveUpdateConfiguration = 4
	// CLLiveUpdateConfigurationAutomotiveNavigation: A configuration for automotive navigation use cases.
	CLLiveUpdateConfigurationAutomotiveNavigation CLLiveUpdateConfiguration = 1
	// CLLiveUpdateConfigurationDefault: The default configuration.
	CLLiveUpdateConfigurationDefault CLLiveUpdateConfiguration = 0
	// CLLiveUpdateConfigurationFitness: A configuration for fitness use cases.
	CLLiveUpdateConfigurationFitness CLLiveUpdateConfiguration = 3
	// CLLiveUpdateConfigurationOtherNavigation: A configuration for other navigation use cases.
	CLLiveUpdateConfigurationOtherNavigation CLLiveUpdateConfiguration = 2
)

func (CLLiveUpdateConfiguration) String

func (e CLLiveUpdateConfiguration) String() string

type CLLocation

type CLLocation struct {
	objectivec.Object
}

The latitude, longitude, and course information reported by the system.

Overview

A CLLocation object contains the geographical location and altitude of a device, along with values indicating the accuracy of those measurements and when they were collected. In iOS, a location object also contains course information — that is, the speed and heading in which the device was moving.

Typically, you don’t create location objects yourself. After you request location updates from your CLLocationManager object, the system uses onboard sensors to gather location data and report that data to your app. Some services also return previously collected location data, which you can use as context to improve your services. You can always retrieve the most recently collected location from the CLLocationManager.Location property of your CLLocationManager object. You may create location objects yourself when you want to cache custom location data or calculate the distance between two geographical coordinates.

Use CLLocation objects as-is, and don’t subclass them.

Creating a location object

Getting the location attributes

Getting the location accuracy

Measuring the distance between coordinates

Getting speed and course information

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLLocation

func CLLocationFromID

func CLLocationFromID(id objc.ID) CLLocation

CLLocationFromID constructs a CLLocation from an objc.ID.

The latitude, longitude, and course information reported by the system.

func NewCLLocation

func NewCLLocation() CLLocation

NewCLLocation creates a new CLLocation instance.

func NewLocationWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseCourseAccuracySpeedSpeedAccuracyTimestamp

func NewLocationWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseCourseAccuracySpeedSpeedAccuracyTimestamp(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, course CLLocationDirection, courseAccuracy CLLocationDirectionAccuracy, speed CLLocationSpeed, speedAccuracy CLLocationSpeedAccuracy, timestamp foundation.NSDate) CLLocation

Creates a location object with the specified coordinate, altitude, course, and accuracy information.

coordinate: A coordinate structure containing the latitude and longitude values.

altitude: The altitude value for the location.

hAccuracy: The radius of uncertainty for the geographical coordinate, measured in meters. Specify a negative number to indicate that the geographical coordinate is invalid.

vAccuracy: The accuracy of the altitude value, measured in meters. Specify a negative number to indicate that the altitude is invalid.

course: The direction of travel for the location, measured in degrees relative to due north and continuing clockwise around the compass.

courseAccuracy: The accuracy of the course value, measured in degrees. Specify a negative number to indicate that the course is invalid.

speed: The current speed associated with this location, measured in meters per second.

speedAccuracy: The accuracy of the speed value, measured in meters per second. Specify a negative number to indicate that the speed is invalid.

timestamp: The time to associate with the location object. Typically, you specify the current time.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:)

func NewLocationWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseSpeedTimestamp

func NewLocationWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseSpeedTimestamp(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, course CLLocationDirection, speed CLLocationSpeed, timestamp foundation.NSDate) CLLocation

Creates a location object with the specified coordinate, altitude, and course information.

coordinate: A coordinate structure containing the latitude and longitude values.

altitude: The altitude value for the location.

hAccuracy: The radius of uncertainty for the geographical coordinate, measured in meters. Specify a negative number to indicate that the geographical coordinate is invalid.

vAccuracy: The accuracy of the altitude value, measured in meters. Specify a negative number to indicate that the altitude is invalid.

course: The direction of travel for the location, measured in degrees relative to due north and continuing clockwise around the compass.

speed: The current speed associated with this location, measured in meters per second.

timestamp: The time to associate with the location object. Typically, you specify the current time.

Return Value

A location object initialized with the specified geographical coordinate, altitude, and course information.

Discussion

Use this method to create location objects that aren’t necessarily based on the user’s current location.Typically, you acquire location objects from your CLLocationManager object, which returns the user’s actual location. However, you might use this method when you want to represent any location on a map. For example, you might create an object to represent the user’s intended destination.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:speed:timestamp:)

func NewLocationWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyTimestamp

func NewLocationWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyTimestamp(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, timestamp foundation.NSDate) CLLocation

Creates a location object with the specified coordinate and altitude information.

coordinate: A coordinate structure containing the latitude and longitude values.

altitude: The altitude value for the location.

hAccuracy: The radius of uncertainty for the geographical coordinate, measured in meters. Specify a negative number to indicate that the geographical coordinate is invalid.

vAccuracy: The accuracy of the altitude value, measured in meters. Specify a negative number to indicate that the altitude is invalid.

timestamp: The time to associate with the location object. Typically, you specify the current time.

Return Value

A location object initialized with the specified geographical coordinate and altitude information.

Discussion

Use this method to create location objects that are not necessarily based on the user’s current location.Typically, you acquire location objects from your CLLocationManager object, which returns the user’s actual location. However, you might use this method when you want to represent any location on a map. For example, you might create an object to represent the user’s intended destination.

This method records the values you provide, and it initializes other properties to appropriate default values. Specifically, this method sets the speed and course values to `-1`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:)

func NewLocationWithLatitudeLongitude

func NewLocationWithLatitudeLongitude(latitude CLLocationDegrees, longitude CLLocationDegrees) CLLocation

Creates a location object with the specified latitude and longitude.

latitude: The latitude of the geographical coordinate.

longitude: The longitude of the geographical coordinate.

Return Value

A location object initialized with the specified geographical coordinate.

Discussion

Use this method to create location objects that are not necessarily based on the user’s current location. Typically, you acquire location objects from your CLLocationManager object, which returns the user’s actual location. However, you might use this method when you want to represent any location on a map. For example, you might create an object to represent the user’s intended destination.

This method records the latitude and longitude values you provide, and it initializes other properties to appropriate default values. Specifically, this method sets the CLLocation.Altitude and CLLocation.HorizontalAccuracy properties to 0, sets the CLLocation.VerticalAccuracy property to `-1` to indicate that the altitude is invalid, sets the CLLocation.Speed and CLLocation.Course values to `-1`, and sets the CLLocation.Timestamp property to the time at which the returned object was created.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/init(latitude:longitude:)

func (CLLocation) Altitude

func (l CLLocation) Altitude() CLLocationDistance

The altitude above mean sea level associated with a location, measured in meters.

Discussion

The CLLocation.Altitude property represents an orthometric height, which is the height above the approximate mean sea level. Positive values indicate altitudes above mean sea level. Negative values indicate altitudes below mean sea level.

When CLLocation.VerticalAccuracy contains `0` or a negative number, the value of CLLocation.Altitude is invalid. The value of CLLocation.Altitude is valid when CLLocation.VerticalAccuracy contains a postive number.

In most cases, Core Location approximates mean sea level using the Earth Gravitational Model 2008 (EGM 2008) geoid associated with the World Geodetic System 1984 (WGS84) standard. In some rare cases, Core Location approximates mean sea level using the DMA 10x10 geoid grid. The discrepancy between these two geoids is typically less than 5 meters.

See CLLocation.EllipsoidalAltitude if your application uses an altitude with respect to the WGS84 reference frame.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/altitude

func (CLLocation) Autorelease

func (l CLLocation) Autorelease() CLLocation

Autorelease adds the receiver to the current autorelease pool.

func (CLLocation) Coordinate

func (l CLLocation) Coordinate() CLLocationCoordinate2D

The geographical coordinate information.

Discussion

When running in the simulator, Core Location uses the values provided to it by the simulator. You must run your application on an iOS-based device to get the actual location of that device.

Special Considerations

In iOS, this property is declared as `nonatomic`. In macOS, it is declared as `atomic`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/coordinate

func (CLLocation) Course

func (l CLLocation) Course() CLLocationDirection

The direction in which the device is traveling, measured in degrees and relative to due north.

Discussion

Course values are measured in degrees starting at due north and continue clockwise around the compass. Thus, north is 0 degrees, east is 90 degrees, south is 180 degrees, and so on. Course values may not be available on all devices. A negative value indicates that the course information is invalid.

Special Considerations

In iOS, this property is declared as `nonatomic`. In macOS, it is declared as `atomic`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/course

func (CLLocation) CourseAccuracy

func (l CLLocation) CourseAccuracy() CLLocationDirectionAccuracy

The accuracy of the course value, measured in degrees.

Discussion

When this property contains `0` or a positive number, the value in the course property is plus or minus the specified number degrees, modulo 360. When this property contains a negative number, the value in the course property is invalid.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/courseAccuracy

func (CLLocation) DistanceFromLocation

func (l CLLocation) DistanceFromLocation(location ICLLocation) CLLocationDistance

Returns the distance (measured in meters) from the current object’s location to the specified location.

location: The destination location.

Return Value

The distance (in meters) between the two locations.

Discussion

This method measures the distance between the location in the current object and the value in the `location` parameter. The distance is calculated by tracing a line between the two points that follows the curvature of the Earth, and measuring the length of the resulting arc. The arc is a smooth curve that doesn’t take into account altitude changes between the two locations.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/distance(from:)

func (CLLocation) EllipsoidalAltitude

func (l CLLocation) EllipsoidalAltitude() CLLocationDistance

The altitude as a height above the World Geodetic System 1984 (WGS84) ellipsoid, measured in meters.

Discussion

The CLLocation.EllipsoidalAltitude property represents the altitude above the WGS84 ellipsoid associated with a location. Use the CLLocation.EllipsoidalAltitude property when your geodetic application needs an altitude with respect to a standard reference frame. Use CLLocation.Altitude if your application needs an altitude with respect to the approximate mean sea level.

The CLLocation.EllipsoidalAltitude value is valid if CLLocation.VerticalAccuracy is greater than `0`, and invalid if CLLocation.VerticalAccuracy is `0` or below. If CLLocation.VerticalAccuracy is `0` or below, CLLocation.EllipsoidalAltitude is invalid and contains the value `0.0`.

Valid values for CLLocation.EllipsoidalAltitude can be positive or negative. Positive values indicate altitudes above the ellipsoid. Negative values indicate altitudes below the ellipsoid.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/ellipsoidalAltitude

func (CLLocation) EncodeWithCoder

func (l CLLocation) EncodeWithCoder(coder foundation.INSCoder)

func (CLLocation) Floor

func (l CLLocation) Floor() ICLFloor

The logical floor of the building in which the user is located.

Discussion

If floor information is not available for the current location, the value of this property is `nil`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/floor

func (CLLocation) HorizontalAccuracy

func (l CLLocation) HorizontalAccuracy() CLLocationAccuracy

The radius of uncertainty for the location, measured in meters.

Discussion

The location’s latitude and longitude identify the center of the circle, and this value indicates the radius of that circle. A negative value indicates that the latitude and longitude are invalid.

Special Considerations

In iOS, this property is declared as `nonatomic`. In macOS, it is declared as `atomic`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/horizontalAccuracy

func (CLLocation) Init

func (l CLLocation) Init() CLLocation

Init initializes the instance.

func (CLLocation) InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseCourseAccuracySpeedSpeedAccuracyTimestamp

func (l CLLocation) InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseCourseAccuracySpeedSpeedAccuracyTimestamp(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, course CLLocationDirection, courseAccuracy CLLocationDirectionAccuracy, speed CLLocationSpeed, speedAccuracy CLLocationSpeedAccuracy, timestamp foundation.NSDate) CLLocation

Creates a location object with the specified coordinate, altitude, course, and accuracy information.

coordinate: A coordinate structure containing the latitude and longitude values.

altitude: The altitude value for the location.

hAccuracy: The radius of uncertainty for the geographical coordinate, measured in meters. Specify a negative number to indicate that the geographical coordinate is invalid.

vAccuracy: The accuracy of the altitude value, measured in meters. Specify a negative number to indicate that the altitude is invalid.

course: The direction of travel for the location, measured in degrees relative to due north and continuing clockwise around the compass.

courseAccuracy: The accuracy of the course value, measured in degrees. Specify a negative number to indicate that the course is invalid.

speed: The current speed associated with this location, measured in meters per second.

speedAccuracy: The accuracy of the speed value, measured in meters per second. Specify a negative number to indicate that the speed is invalid.

timestamp: The time to associate with the location object. Typically, you specify the current time.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:)

func (CLLocation) InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseSpeedTimestamp

func (l CLLocation) InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseSpeedTimestamp(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, course CLLocationDirection, speed CLLocationSpeed, timestamp foundation.NSDate) CLLocation

Creates a location object with the specified coordinate, altitude, and course information.

coordinate: A coordinate structure containing the latitude and longitude values.

altitude: The altitude value for the location.

hAccuracy: The radius of uncertainty for the geographical coordinate, measured in meters. Specify a negative number to indicate that the geographical coordinate is invalid.

vAccuracy: The accuracy of the altitude value, measured in meters. Specify a negative number to indicate that the altitude is invalid.

course: The direction of travel for the location, measured in degrees relative to due north and continuing clockwise around the compass.

speed: The current speed associated with this location, measured in meters per second.

timestamp: The time to associate with the location object. Typically, you specify the current time.

Return Value

A location object initialized with the specified geographical coordinate, altitude, and course information.

Discussion

Use this method to create location objects that aren’t necessarily based on the user’s current location.Typically, you acquire location objects from your CLLocationManager object, which returns the user’s actual location. However, you might use this method when you want to represent any location on a map. For example, you might create an object to represent the user’s intended destination.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:speed:timestamp:)

func (CLLocation) InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyTimestamp

func (l CLLocation) InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyTimestamp(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, timestamp foundation.NSDate) CLLocation

Creates a location object with the specified coordinate and altitude information.

coordinate: A coordinate structure containing the latitude and longitude values.

altitude: The altitude value for the location.

hAccuracy: The radius of uncertainty for the geographical coordinate, measured in meters. Specify a negative number to indicate that the geographical coordinate is invalid.

vAccuracy: The accuracy of the altitude value, measured in meters. Specify a negative number to indicate that the altitude is invalid.

timestamp: The time to associate with the location object. Typically, you specify the current time.

Return Value

A location object initialized with the specified geographical coordinate and altitude information.

Discussion

Use this method to create location objects that are not necessarily based on the user’s current location.Typically, you acquire location objects from your CLLocationManager object, which returns the user’s actual location. However, you might use this method when you want to represent any location on a map. For example, you might create an object to represent the user’s intended destination.

This method records the values you provide, and it initializes other properties to appropriate default values. Specifically, this method sets the speed and course values to `-1`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:)

func (CLLocation) InitWithLatitudeLongitude

func (l CLLocation) InitWithLatitudeLongitude(latitude CLLocationDegrees, longitude CLLocationDegrees) CLLocation

Creates a location object with the specified latitude and longitude.

latitude: The latitude of the geographical coordinate.

longitude: The longitude of the geographical coordinate.

Return Value

A location object initialized with the specified geographical coordinate.

Discussion

Use this method to create location objects that are not necessarily based on the user’s current location. Typically, you acquire location objects from your CLLocationManager object, which returns the user’s actual location. However, you might use this method when you want to represent any location on a map. For example, you might create an object to represent the user’s intended destination.

This method records the latitude and longitude values you provide, and it initializes other properties to appropriate default values. Specifically, this method sets the CLLocation.Altitude and CLLocation.HorizontalAccuracy properties to 0, sets the CLLocation.VerticalAccuracy property to `-1` to indicate that the altitude is invalid, sets the CLLocation.Speed and CLLocation.Course values to `-1`, and sets the CLLocation.Timestamp property to the time at which the returned object was created.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/init(latitude:longitude:)

func (CLLocation) SourceInformation

func (l CLLocation) SourceInformation() ICLLocationSourceInformation

Information about the source that provides the location.

Discussion

This property enables developers to make better-informed decisions as to whether to treat certain locations differently, or reject potentially simulated locations that they generate during testing. An app may choose to check this property and reject locations if, for example, the CLLocationSourceInformation.IsSimulatedBySoftware property is `true` when the developer isn’t debugging or testing the app.

Use the CLLocation.SourceInformation property when knowing the true location of the device (within a tolerance for estimation error and horizontal/vertical accuracy) is critical.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/sourceInformation

func (CLLocation) Speed

func (l CLLocation) Speed() CLLocationSpeed

The instantaneous speed of the device, measured in meters per second.

Discussion

This value reflects the instantaneous speed of the device as it moves in the direction of its current heading. A negative value indicates an invalid speed. Because the actual speed can change many times between the delivery of location events, use this property for informational purposes only.

Special Considerations

In iOS, this property is declared as `nonatomic`. In macOS, it is declared as `atomic`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/speed

func (CLLocation) SpeedAccuracy

func (l CLLocation) SpeedAccuracy() CLLocationSpeedAccuracy

The accuracy of the speed value, measured in meters per second.

Discussion

When this property contains `0` or a positive number, the value in the speed property is plus or minus the specified number of meters per second. When this property contains a negative number, the value in the speed property is invalid.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/speedAccuracy

func (CLLocation) Timestamp

func (l CLLocation) Timestamp() foundation.NSDate

The time at which this location was determined.

Discussion

In iOS, this property is declared as `nonatomic`. In macOS, it is declared as `atomic`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/timestamp

func (CLLocation) VerticalAccuracy

func (l CLLocation) VerticalAccuracy() CLLocationAccuracy

The validity of the altitude values, and their estimated uncertainty, measured in meters.

Discussion

A positive CLLocation.VerticalAccuracy value represents the estimated uncertainty associated with CLLocation.Altitude and CLLocation.EllipsoidalAltitude. This value is available whenever altitude values are available.

If CLLocation.VerticalAccuracy is `0` or a negative number, CLLocation.Altitude and CLLocation.EllipsoidalAltitude values are invalid. If CLLocation.VerticalAccuracy is a postive number, CLLocation.Altitude and CLLocation.EllipsoidalAltitude values are valid.

A positive CLLocation.VerticalAccuracy value represents an uncertainty that’s approximately 68 percent, or one standard deviation, above and below the altitude values.

See: https://developer.apple.com/documentation/CoreLocation/CLLocation/verticalAccuracy

type CLLocationAccuracy

type CLLocationAccuracy = float64

CLLocationAccuracy is the accuracy of a geographical coordinate.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationAccuracy

type CLLocationArrayErrorHandler

type CLLocationArrayErrorHandler = func(*[]CLLocation, error)

CLLocationArrayErrorHandler is the signature for a completion handler block.

Used by:

  • [CLLocationManager.RequestHistoricalLocationsWithPurposeKeySampleCountCompletionHandler]

type CLLocationClass

type CLLocationClass struct {
	// contains filtered or unexported fields
}

func GetCLLocationClass

func GetCLLocationClass() CLLocationClass

GetCLLocationClass returns the class object for CLLocation.

func (CLLocationClass) Alloc

func (cc CLLocationClass) Alloc() CLLocation

Alloc allocates memory for a new instance of the class.

func (CLLocationClass) Class

func (cc CLLocationClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLLocationCoordinate2D

type CLLocationCoordinate2D struct {
	Latitude  CLLocationDegrees // The latitude in degrees.
	Longitude CLLocationDegrees // The longitude in degrees.

}

CLLocationCoordinate2D - The latitude and longitude associated with a location, specified using the WGS 84 reference frame.

[Full Topic] [Full Topic]: https://developer.apple.com/documentation/CoreLocation/CLLocationCoordinate2D

var (
	// KCLLocationCoordinate2DInvalid is an invalid coordinate value.
	//
	// See: https://developer.apple.com/documentation/CoreLocation/kCLLocationCoordinate2DInvalid
	KCLLocationCoordinate2DInvalid CLLocationCoordinate2D
)

func CLLocationCoordinate2DMake

func CLLocationCoordinate2DMake(latitude CLLocationDegrees, longitude CLLocationDegrees) CLLocationCoordinate2D

CLLocationCoordinate2DMake formats a latitude and longitude value into a coordinate data structure format.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationCoordinate2DMake(_:_:)

type CLLocationDegrees

type CLLocationDegrees = float64

CLLocationDegrees is a latitude or longitude value specified in degrees.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationDegrees

type CLLocationDirection

type CLLocationDirection = float64

CLLocationDirection is an azimuth that is measured in degrees relative to true north.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationDirection

type CLLocationDirectionAccuracy

type CLLocationDirectionAccuracy = float64

CLLocationDirectionAccuracy is the accuracy of a compass heading.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationDirectionAccuracy

type CLLocationDistance

type CLLocationDistance = float64

CLLocationDistance is a distance in meters from an existing location.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationDistance

type CLLocationManager

type CLLocationManager struct {
	objectivec.Object
}

The object you use to start and stop the delivery of location-related events to your app.

Overview

A CLLocationManager object is the central place to manage your app’s location-related behaviors. Use a location-manager object to configure, start, and stop location services. You might use these services to:

- Track large or small changes in the user’s current location with a configurable degree of accuracy. - Report heading changes from the onboard compass. - Monitor geographical regions of interest and generate events when someone enters or leaves those regions. - Report the range to nearby Bluetooth beacons.

Create one or more location-manager objects in your app and use them where you need location data. After you create a location-manager object, configure it so that Core Location knows how often to report location changes. In particular, configure the CLLocationManager.DistanceFilter and CLLocationManager.DesiredAccuracy properties with values that reflect your app’s needs.

A CLLocationManager object reports all location-related updates to its CLLocationManager.Delegate object, which is an object that conforms to the CLLocationManagerDelegate protocol. Assign the delegate immediately when you configure your location manager, because the system reports the app’s authorization status to the delegate’s [LocationManagerDidChangeAuthorization] method after the location manager finishes initializing itself. Core Location calls the methods of your delegate object using the RunLoop of the thread on which you initialized the CLLocationManager object. That thread must itself have an active RunLoop, like the one found in your app’s main thread.

For more information, see Configuring your app to use location services.

Determining the availability of services

Receiving data from location services

Requesting authorization for location services

Specifying distance and accuracy

Running the standard location service

Running the significant change location service

Running the visits location service

Running the heading service

Running the region-monitoring service

Performing beacon ranging

Getting recent location and heading data

Instance Properties

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager

func CLLocationManagerFromID

func CLLocationManagerFromID(id objc.ID) CLLocationManager

CLLocationManagerFromID constructs a CLLocationManager from an objc.ID.

The object you use to start and stop the delivery of location-related events to your app.

func NewCLLocationManager

func NewCLLocationManager() CLLocationManager

NewCLLocationManager creates a new CLLocationManager instance.

func (CLLocationManager) AccuracyAuthorization

func (l CLLocationManager) AccuracyAuthorization() CLAccuracyAuthorization

A value that indicates the level of location accuracy the app has permission to use.

Discussion

If the value of this property is CLAccuracyAuthorizationFullAccuracy, you can set the CLLocationManager.DesiredAccuracy property to any value. If the value is CLAccuracyAuthorizationReducedAccuracy, setting CLLocationManager.DesiredAccuracy to a value other than kCLLocationAccuracyReduced has no effect on the location information, and your app can’t use region monitoring or beacon ranging.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/accuracyAuthorization

func (CLLocationManager) ActivityType

func (l CLLocationManager) ActivityType() CLActivityType

The type of activity the app expects the user to typically perform while in the app’s location session.

Discussion

An app should use `activityType` to communicate to Core Location algorithms the type of activity the app’s users typically perform while using the app. The location manager uses the information in this property as a cue to determine when the system may pause location updates. Pausing updates gives the system the opportunity to save power in situations where the user’s location isn’t likely to be changing. For example, if the activity type is CLActivityTypeAutomotiveNavigation and no location changes have occurred recently, the system might power down radios until the system detects movement again.

After a pause occurs, it’s your responsibility to restart location services again when you determine that they’re needed. For more information on ways to restart location services after a pause, see the discussion of the CLLocationManager.PausesLocationUpdatesAutomatically property.

The default value of this property is CLActivityTypeOther.

If your app allows the user to change the type activity they’re performing, for example in a navigation app that allows the user to switch between driving or walking modes, you should also update the `activityType` as well.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/activityType

func (CLLocationManager) AllowsBackgroundLocationUpdates

func (l CLLocationManager) AllowsBackgroundLocationUpdates() bool

A Boolean value that indicates whether the app receives location updates when running in the background.

Discussion

Apps that receive location updates when running in the background must include the UIBackgroundModes key (with the `location` value) in their app’s `Info.Plist()` file. After including the UIBackgroundModes key, set the value of CLLocationManager.AllowsBackgroundLocationUpdates to true. Use this property to enable and disable background updates programmatically. For example, you might set this property to true only after the user enables features in your app that require background location updates.

When the value of this property is true and you start location updates while the app is in the foreground, Core Location configures the system to keep the app running to receive continuous background location updates, and arranges to show the background location indicator (blue bar or pill) if needed. Updates continue even if the app subsequently enters the background.

When the value of this property is false, location updates may or may not continue in the background depending on other factors, including other background modes. In this configuration Core Location doesn’t configure the system to keep the app running for delivery, or display the background location indicator to extend the effectiveness of the KCLAuthorizationStatusAuthorizedWhenInUse authorization while the app is running in the background.

The default value of this property is false.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/allowsBackgroundLocationUpdates

func (CLLocationManager) AuthorizationStatus

func (l CLLocationManager) AuthorizationStatus() CLAuthorizationStatus

The current authorization status for the app.

Return Value

A value indicating whether the app is authorized to use location services.

Discussion

Check this value when the [LocationManagerDidChangeAuthorization] delegate callback indicates that the authorization status has changed.

The system is guaranteed to call the delegate method with the app’s initial authorization state and all authorization status changes.

The system manages the authorization status of a given app according to several factors. Users must authorize the app to use location services explicitly, and location services must be enabled in Settings > Privacy. See [Choosing the Location Services Authorization to Request] for more information.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/authorizationStatus-swift.property

func (CLLocationManager) Autorelease

func (l CLLocationManager) Autorelease() CLLocationManager

Autorelease adds the receiver to the current autorelease pool.

func (CLLocationManager) Delegate

The delegate object to receive update events.

Discussion

In iOS, this property is declared as `nonatomic`. In macOS, it is declared as `atomic`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/delegate

func (CLLocationManager) DesiredAccuracy

func (l CLLocationManager) DesiredAccuracy() CLLocationAccuracy

The accuracy of the location data that your app wants to receive.

Discussion

The location service does its best to achieve the requested accuracy; however, apps must be prepared to use less accurate data. If your app isn’t authorized to access precise location information (`isAuthorizedForPreciseLocation` is false), changes to this property’s value have no effect; the accuracy is always kCLLocationAccuracyReduced.

To reduce your app’s impact on battery life, assign a value to this property that’s appropriate for your usage. For example, if you need the current location only within a kilometer, specify kCLLocationAccuracyKilometer. More accurate location data also takes more time to become available.

After you request high-accuracy location data, your app might still get data with a lower accuracy for a period of time. During the time it takes to determine the location within the requested accuracy, the location service keeps providing the data that’s available, even though that data isn’t as accurate as your app requested. Your app receives more accurate location data as that data becomes available.

For iOS, the default value of this property is kCLLocationAccuracyBest. For macOS, watchOS, and tvOS, the default value is kCLLocationAccuracyHundredMeters.

This property effects only the standard location services, not for monitoring significant location changes.

Special Considerations

In iOS, this property is declared as `nonatomic`. In macOS, it is declared as `atomic`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/desiredAccuracy

func (CLLocationManager) DismissHeadingCalibrationDisplay

func (l CLLocationManager) DismissHeadingCalibrationDisplay()

Dismisses the heading calibration view from the screen immediately.

Discussion

Core Location uses the heading calibration alert to calibrate the available heading hardware as needed. The display of this view is automatic, assuming your delegate supports displaying the view at all. If the view is displayed, you can use this method to dismiss it after an appropriate amount of time to ensure that your app’s user interface is not unduly disrupted.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/dismissHeadingCalibrationDisplay()

func (CLLocationManager) DistanceFilter

func (l CLLocationManager) DistanceFilter() CLLocationDistance

The minimum distance in meters the device must move horizontally before an update event is generated.

Discussion

This location manager measures this relative to the previously delivered location. Specify the value kCLDistanceFilterNone to receive notifications for all movements. The default value of this property is kCLDistanceFilterNone.

Use this property only in conjunction with the Standard location services and not with the Significant-change or Visits services.

Special Considerations

In iOS, this property is declared as `nonatomic`. In macOS, it is declared as `atomic`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/distanceFilter

func (CLLocationManager) Heading

func (l CLLocationManager) Heading() ICLHeading

The most recently reported heading.

Discussion

The value of this property is `nil` if heading updates have never been initiated.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/heading

func (CLLocationManager) HeadingFilter

func (l CLLocationManager) HeadingFilter() CLLocationDegrees

The minimum angular change in degrees required to generate new heading events.

Discussion

The angular distance is measured relative to the last delivered heading event. Use the value kCLHeadingFilterNone to be notified of all movements. The default value of this property is `1` degree.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/headingFilter

func (CLLocationManager) HeadingOrientation

func (l CLLocationManager) HeadingOrientation() CLDeviceOrientation

The device orientation to use when computing heading values.

Discussion

When computing heading values, the location manager assumes that the top of the device in portrait mode represents due north (0 degrees) by default. For apps that run in other orientations, this may not always be the most convenient orientation. This property allows you to specify which device orientation you want the location manager to use as the reference point for due north.

Although you can set the value of this property to CLDeviceOrientationUnknown, CLDeviceOrientationFaceUp, or CLDeviceOrientationFaceDown, doing so has no effect on the orientation reference point. The original reference point is retained instead.

Changing the value in this property affects only those heading values reported after the change is made.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/headingOrientation

func (CLLocationManager) Init

Init initializes the instance.

func (CLLocationManager) IsAuthorizedForWidgetUpdates

func (l CLLocationManager) IsAuthorizedForWidgetUpdates() bool

A Boolean value that indicates whether a widget is eligible to receive location updates.

Discussion

This property is `true` when either of the following is true:

- The app’s authorization status is KCLAuthorizationStatusAuthorizedAlways. - The app’s authorization status is KCLAuthorizationStatusAuthorizedWhenInUse and the user agrees to extend the app’s authorization status to widgets.

For details about using location information in widgets with KCLAuthorizationStatusAuthorizedWhenInUse, see Accessing location information in widgets.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/isAuthorizedForWidgetUpdates

func (CLLocationManager) Location

func (l CLLocationManager) Location() ICLLocation

The most recently retrieved user location.

Discussion

The value of this property is `nil` if no location data has ever been retrieved.

In iOS 4.0 and later, this property may contain a more recent location object at launch time. Specifically, if significant location updates are running and your app is terminated, this property is updated with the most recent location data when your app is relaunched (and you create a new location manager object). This location data may be more recent than the last location event processed by your app.

It is always a good idea to check the timestamp of the location stored in this property. If the receiver is currently gathering location data, but the minimum distance filter is large, the returned location might be relatively old. If it is, you can stop the receiver and start it again to force an update.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/location

func (CLLocationManager) MaximumRegionMonitoringDistance

func (l CLLocationManager) MaximumRegionMonitoringDistance() CLLocationDistance

The largest boundary distance that can be assigned to a region.

Discussion

This property defines the largest boundary distance allowed from a region’s center point. Attempting to monitor a region with a distance larger than this value causes the location manager to send a KCLErrorRegionMonitoringFailure error to the delegate.

If region monitoring is unavailable or not supported, the value in this property is `-1`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/maximumRegionMonitoringDistance

func (CLLocationManager) MonitoredRegions

func (l CLLocationManager) MonitoredRegions() foundation.INSSet

The set of shared regions monitored by all location-manager objects.

Discussion

You cannot add regions to this property directly. Instead, you must register regions by calling the [CLLocationManager.StartMonitoringForRegion] method. The regions in this property are shared by all instances of the CLLocationManager class in your app.

The objects in this set may not necessarily be the same objects you specified at registration time. Only the region data itself is maintained by the system. Therefore, the only way to uniquely identify a registered region is using its CLRegion.Identifier property.

The location manager persists region data between launches of your app. If your app is terminated and then relaunched, the contents of this property are repopulated with region objects that contain the previously registered data.

In a compatible iPad or iPhone app running in visionOS, the property contains an empty set.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/monitoredRegions

func (CLLocationManager) PausesLocationUpdatesAutomatically

func (l CLLocationManager) PausesLocationUpdatesAutomatically() bool

A Boolean value that indicates whether the location-manager object may pause location updates.

Discussion

Allowing the location manager to pause updates can improve battery life on the target device without sacrificing location data. Setting this property to true causes the location manager to pause updates (and powers down the appropriate hardware) at times when the location data is unlikely to change. For example, if the user stops for food while using a navigation app, the location manager might pause updates for a period of time. You can help the determination of when to pause location updates by assigning a value to the CLLocationManager.ActivityType property.

After a pause occurs, it’s your responsibility to restart location services again when you determine that they’re needed. Core Location calls the [LocationManagerDidPauseLocationUpdates] method of your location manager’s delegate to let you know that a pause has occurred. In that method configure a local notification that has a UNLocationNotificationTrigger to notify when the user exits the current region. The message for the local notification should prompt the user to launch your app again so that it can resume updates.

On supported platforms the default value of this property is true; otherwise the default value is false and is immutable.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/pausesLocationUpdatesAutomatically

func (CLLocationManager) RangedBeaconConstraints

func (l CLLocationManager) RangedBeaconConstraints() foundation.INSSet

The set of beacon constraints currently being tracked using ranging.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/rangedBeaconConstraints

func (CLLocationManager) RequestAlwaysAuthorization

func (l CLLocationManager) RequestAlwaysAuthorization()

Requests the user’s permission to use location services regardless of whether the app is in use.

Discussion

You must call this or the CLLocationManager.RequestWhenInUseAuthorization method before your app can receive location information. To call this method, you must have both NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription keys in your app’s `Info.Plist()` file. You may call CLLocationManager.RequestAlwaysAuthorization when the current authorization state is either:

- Not Determined — KCLAuthorizationStatusNotDetermined - When In Use — KCLAuthorizationStatusAuthorizedWhenInUse

Use the [LocationManagerDidUpdateLocations] method on the CLLocationManager delegate to receive updates when the user makes permission choices.

Core Location limits calls to CLLocationManager.RequestAlwaysAuthorization. After your app calls this method, further calls have no effect. If a compatible iPad or iPhone app calls this method when running in visionOS, the method treats it as a request for When in Use authorization instead.

Request Always Authorization After Getting When In Use

To obtain Always authorization, your app must first request When In Use permission followed by requesting Always authorization.

If the user grants When In Use permission after your app calls CLLocationManager.RequestWhenInUseAuthorization, then calling CLLocationManager.RequestAlwaysAuthorization immediately prompts the user to request Always permission. If the user responded to CLLocationManager.RequestWhenInUseAuthorization with Allow Once, then Core Location ignores further calls to CLLocationManager.RequestAlwaysAuthorization due to the temporary authorization.

Core Location prompts the user to grant permission with the string from NSLocationAlwaysUsageDescription. The user prompt displays the following options, which determine the authorization your app can receive:

[Table data omitted]

Request Always Authorization Directly

If your app’s current state is KCLAuthorizationStatusNotDetermined and you call CLLocationManager.RequestAlwaysAuthorization, Core Location uses two prompts before it fully enables Always authorization.

The first prompt displays immediately with the string from NSLocationWhenInUseUsageDescription. The user prompt displays the following options, which determine the authorization your app receives:

[Table data omitted]

The second prompt displays when Core Location prepares to deliver an event to your app requiring KCLAuthorizationStatusAuthorizedAlways. If the app is in the Provisional Always state, the system displays the second prompt with the string from NSLocationAlwaysUsageDescription. Core Location will typically display the second prompt when your app isn’t running.

Your app receives permanent Always authorization if the user chooses to grant permission when the second prompt appears while in the Provisional Always state. When the user responds, your app receives either the location event or a call to your delegate with the modified authorization.

When displaying the second prompt, the user sees one of the following options:

[Table data omitted]

If the user responds to the prompt near the time it was delivered and chooses to allow the Always permission, the location event will be delivered to your app.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/requestAlwaysAuthorization()

func (CLLocationManager) RequestLocation

func (l CLLocationManager) RequestLocation()

Requests the one-time delivery of the user’s current location.

Discussion

This method returns immediately. Calling it causes the location manager to obtain a location fix (which may take several seconds) and call the delegate’s [LocationManagerDidUpdateLocations] method with the result. The location fix is obtained at the accuracy level indicated by the CLLocationManager.DesiredAccuracy property. Only one location fix is reported to the delegate, after which location services are stopped. If a location fix cannot be determined in a timely manner, the location manager calls the delegate’s [LocationManagerDidFailWithError] method instead and reports a KCLErrorLocationUnknown error.

Use this method when you want the user’s current location but do not need to leave location services running. This method starts location services long enough to return a result or report an error and then stops them again. Calling the CLLocationManager.StartUpdatingLocation or allowDeferredLocationUpdates(untilTraveled:timeout:) method cancels any pending request made using this method. Calling this method while location services are already running does nothing. To cancel a pending request, call the CLLocationManager.StopUpdatingLocation method.

If obtaining the desired accuracy would take too long, the location manager delivers a less accurate location value rather than reporting an error.

When using this method, the associated delegate must implement the [LocationManagerDidUpdateLocations] and [LocationManagerDidFailWithError] methods. Failure to do so is a programmer error.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/requestLocation()

func (CLLocationManager) RequestTemporaryFullAccuracyAuthorizationWithPurposeKey

func (l CLLocationManager) RequestTemporaryFullAccuracyAuthorizationWithPurposeKey(purposeKey string)

Requests permission to temporarily use location services with full accuracy.

purposeKey: A key in the NSLocationTemporaryUsageDescriptionDictionary dictionary of the app’s `Info.Plist()` file. The value for this key is an app-provided string that describes the reason for accessing location data with full accuracy. To localize a usage description, add an entry to your `InfoPlist.Strings()` file with the same key you provide for this parameter.

Discussion

This method behaves the same as calling the CLLocationManager.RequestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletion method, passing `nil` as the completion closure. Use this method if your app’s logic to respond to changes in location data accuracy is already handled by the [LocationManagerDidChangeAuthorization] delegate method, and your app doesn’t have any work to do in the closure.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/requestTemporaryFullAccuracyAuthorization(withPurposeKey:)

func (CLLocationManager) RequestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletion

func (l CLLocationManager) RequestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletion(purposeKey string, completion ErrorHandler)

Requests permission to temporarily use location services with full accuracy and reports the results to the provided completion handler.

purposeKey: A key in the NSLocationTemporaryUsageDescriptionDictionary dictionary of the app’s `Info.Plist()` file. The value for this key is an app-provided string that describes the reason for accessing location data with full accuracy. To localize a usage description, add an entry to your `InfoPlist.Strings()` file with the same key you provide for this parameter.

completion: A closure to execute after authorization status changes. This closure takes a single `error` parameter, which is `nil` if the prompt was displayed to the user, or an error object describing why the prompt couldn’t be displayed.

Discussion

After the user gives permission for your app to use location data with full accuracy, your app can access that data in the foreground or in the background, until its permission automatically expires. Expiration is postponed while your app is actively in use. For example, expiration is postponed while your app in the foreground, and while a Continuous Background Location session is active with the background location indicator enabled. This approach to expiration allows apps to provide experiences that require full accuracy, such as fitness and navigation apps, even if the user doesn’t grant persistent access for full accuracy.

The completion closure is guaranteed to be called after the request is completed, which includes the user granting access, the user declining, or an error that prevented displaying the prompt. The closure is always called in the same threading context as CLLocationManagerDelegate methods. If the prompt was successfully displayed to the user, the callback’s `error` parameter is `nil`.

The request always fails with a KCLErrorPromptDeclined error in the following cases:

- The `Info.Plist()` file doesn’t have an entry for the given `purposeKey` value. - The app is already authorized for full accuracy. - The app is in the background.

If the closure is called with an error, log the error for debugging purposes, and retry the request again the next time the user performs the action that caused you to request precise location information.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/requestTemporaryFullAccuracyAuthorization(withPurposeKey:completion:)

func (CLLocationManager) RequestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletionSync

func (l CLLocationManager) RequestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletionSync(ctx context.Context, purposeKey string) error

RequestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletionSync is a synchronous wrapper around CLLocationManager.RequestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletion. It blocks until the completion handler fires or the context is cancelled.

func (CLLocationManager) RequestWhenInUseAuthorization

func (l CLLocationManager) RequestWhenInUseAuthorization()

Requests the user’s permission to use location services while the app is in use.

Discussion

You must call this method or CLLocationManager.RequestAlwaysAuthorization before you can receive location-related information. You may call CLLocationManager.RequestWhenInUseAuthorization whenever the current authorization status is not determined (KCLAuthorizationStatusNotDetermined).

This method runs asynchronously and prompts the user to grant permission to the app to use location services. The user prompt contains the text from the NSLocationWhenInUseUsageDescription key in your app `Info.Plist()` file, and the presence of that key is required when calling this method. The user prompt displays the following options, which determine the authorization your app can receive.

[Table data omitted]

After the user makes a selection and determines the status, the location manager delivers the results to the delegate’s locationManager(_:didChangeAuthorization:) method. If the initial authorization status is anything other than KCLAuthorizationStatusNotDetermined, this method does nothing and doesn’t call the locationManager(_:didChangeAuthorization:) method.

If the user’s choice grants When In Use authorization to your app, your app can start any location service and is eligible to receive the results while it’s in use. If the user’s choice grants temporary When In Use authorization, the authorization expires when the app is no longer in use, reverting to Not Determined status (KCLAuthorizationStatusNotDetermined). For information about when an app is considered to be in use, see [Choosing the Location Services Authorization to Request].

When your app starts standard location services in the foreground, they continue to run in the background if your app has enabled background location updates in the Capabilities tab of your Xcode project. Attempts to start location updates while your app runs in the background will fail. The system displays a location services indicator in the status bar when your app moves to the background with active location services.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/requestWhenInUseAuthorization()

func (CLLocationManager) SetActivityType

func (l CLLocationManager) SetActivityType(value CLActivityType)

func (CLLocationManager) SetAllowsBackgroundLocationUpdates

func (l CLLocationManager) SetAllowsBackgroundLocationUpdates(value bool)

func (CLLocationManager) SetDelegate

func (l CLLocationManager) SetDelegate(value CLLocationManagerDelegate)

func (CLLocationManager) SetDesiredAccuracy

func (l CLLocationManager) SetDesiredAccuracy(value CLLocationAccuracy)

func (CLLocationManager) SetDistanceFilter

func (l CLLocationManager) SetDistanceFilter(value CLLocationDistance)

func (CLLocationManager) SetHeadingBody

func (l CLLocationManager) SetHeadingBody(value CLBodyIdentifiable)

func (CLLocationManager) SetHeadingFilter

func (l CLLocationManager) SetHeadingFilter(value CLLocationDegrees)

func (CLLocationManager) SetHeadingOrientation

func (l CLLocationManager) SetHeadingOrientation(value CLDeviceOrientation)

func (CLLocationManager) SetPausesLocationUpdatesAutomatically

func (l CLLocationManager) SetPausesLocationUpdatesAutomatically(value bool)

func (CLLocationManager) StartMonitoringSignificantLocationChanges

func (l CLLocationManager) StartMonitoringSignificantLocationChanges()

Starts the generation of updates based on significant location changes.

Discussion

This method initiates the delivery of location events asynchronously, returning shortly after you call it. Location events are delivered to your delegate’s [LocationManagerDidUpdateLocations] method. The first event to be delivered is usually the most recently cached location event (if any) but may be a newer event in some circumstances. Obtaining a current location fix may take several additional seconds, so be sure to check the timestamps on the location events in your delegate method.

After returning a current location fix, the receiver generates update events only when a significant change in the user’s location is detected. It does not rely on the value in the CLLocationManager.DistanceFilter property to generate events. Calling this method several times in succession does not automatically result in new events being generated. Calling CLLocationManager.StopMonitoringSignificantLocationChanges in between, however, does cause a new initial event to be sent the next time you call this method.

If you start this service and your app is subsequently terminated, the system automatically relaunches the app into the background if a new event arrives. In such a case, the options dictionary passed to the application(_:willFinishLaunchingWithOptions:) and application(_:didFinishLaunchingWithOptions:) methods of your app delegate contains the key location to indicate that your app was launched because of a location event. Upon relaunch, you must still configure a location manager object and call this method to continue receiving location events. When you restart location services, the current event is delivered to your delegate immediately. In addition, the CLLocationManager.Location property of your location manager object is populated with the most recent location object even before you start location services.

In addition to your delegate object implementing the [LocationManagerDidUpdateLocations] method, it should also implement the [LocationManagerDidFailWithError] method to respond to potential errors.

If a compatible iPad or iPhone app calls this method when running in visionOS, the method does nothing.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/startMonitoringSignificantLocationChanges()

func (CLLocationManager) StartMonitoringVisits

func (l CLLocationManager) StartMonitoringVisits()

Starts the delivery of visit-related events.

Discussion

Calling this method begins the delivery of visit-related events to your app. Enabling visit events for one location manager enables visit events for all other location manager objects in your app. When a new visit event arrives, the location manager object delivers the event to the [LocationManagerDidVisit] method of its delegate.

Your app can monitor for visit events without calling `requestTemporaryPreciseLocationAuthorization()`. In that case, the visit events use reduced accuracy, as reflected by the CLVisit.HorizontalAccuracy property of CLVisit.

If your app is terminated while this service is active, the system relaunches your app when new visit events are ready to be delivered. Upon relaunch, recreate your location manager object and assign a delegate to begin receiving visit events. You don’t need to call this method again to restart the delivery of visit events, but calling it does no harm.

If a compatible iPad or iPhone app calls this method when running in visionOS, the method does nothing.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/startMonitoringVisits()

func (CLLocationManager) StartRangingBeaconsSatisfyingConstraint

func (l CLLocationManager) StartRangingBeaconsSatisfyingConstraint(constraint ICLBeaconIdentityConstraint)

Starts the delivery of notifications for the specified beacon constraints.

constraint: A CLBeaconIdentityConstraint constraint.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/startRangingBeacons(satisfying:)

func (CLLocationManager) StartUpdatingHeading

func (l CLLocationManager) StartUpdatingHeading()

Starts the generation of updates that report the user’s current heading.

Discussion

This method returns immediately. Calling this method when the receiver is stopped causes it to obtain an initial heading and notify your delegate. After that, the receiver generates update events when the value in the CLLocationManager.HeadingFilter property is exceeded.

Before calling this method, you should always check the headingAvailable property to see whether heading information is supported on the current device. If heading information is not supported, calling this method has no effect and does not result in the delivery of events to your delegate.

Calling this method several times in succession does not automatically result in new events being generated. Calling [CLLocationManager.StopUpdatingHeading] in between, however, does cause a new initial event to be sent the next time you call this method.

If you start this service and your app is suspended, the system stops the delivery of events until your app starts running again (either in the foreground or background). If your app is terminated, the delivery of new heading events stops altogether and must be restarted by your code when the app is relaunched.

Heading events are delivered to the [LocationManagerDidUpdateHeading] method of your delegate. If there is an error, the location manager calls the [LocationManagerDidFailWithError] method of your delegate instead.

If a compatible iPad or iPhone app calls this method when running in visionOS, the method does nothing.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/startUpdatingHeading()

func (CLLocationManager) StartUpdatingLocation

func (l CLLocationManager) StartUpdatingLocation()

Starts the generation of updates that report the user’s current location.

Discussion

This method returns immediately. Calling this method causes the location manager to obtain an initial location fix (which may take several seconds) and notify your delegate by calling its [LocationManagerDidUpdateLocations] method. After that, the receiver generates update events primarily when the value in the CLLocationManager.DistanceFilter property is exceeded. Updates may be delivered in other situations though. For example, the receiver may send another notification if the hardware gathers a more accurate location reading.

Calling this method several times in succession does not automatically result in new events being generated. Calling CLLocationManager.StopUpdatingLocation in between, however, does cause a new initial event to be sent the next time you call this method.

If you start this service and your app is suspended, the system stops the delivery of events until your app starts running again (either in the foreground or background). If your app is terminated, the delivery of new location events stops altogether. Therefore, if your app needs to receive location events while in the background, it must include the [UIBackgroundModes] key (with the `location` value) in its `Info.Plist()` file.

In addition to your delegate object implementing the [LocationManagerDidUpdateLocations] method, it should also implement the [LocationManagerDidFailWithError] method to respond to potential errors.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/startUpdatingLocation()

func (CLLocationManager) StopMonitoringSignificantLocationChanges

func (l CLLocationManager) StopMonitoringSignificantLocationChanges()

Stops the delivery of location events based on significant location changes.

Discussion

Use this method to stop the delivery of location events that was started using the CLLocationManager.StartMonitoringSignificantLocationChanges method. If a compatible iPad or iPhone app calls this method when running in visionOS, the method does nothing.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/stopMonitoringSignificantLocationChanges()

func (CLLocationManager) StopMonitoringVisits

func (l CLLocationManager) StopMonitoringVisits()

Stops the delivery of visit-related events.

Discussion

Calling this method disables the delivery of visit-related events for your app. If a compatible iPad or iPhone app calls this method when running in visionOS, the method does nothing.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/stopMonitoringVisits()

func (CLLocationManager) StopRangingBeaconsSatisfyingConstraint

func (l CLLocationManager) StopRangingBeaconsSatisfyingConstraint(constraint ICLBeaconIdentityConstraint)

Stops the delivery of notifications for the specified beacon constraints.

constraint: A CLBeaconIdentityConstraint constraint.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/stopRangingBeacons(satisfying:)

func (CLLocationManager) StopUpdatingLocation

func (l CLLocationManager) StopUpdatingLocation()

Stops the generation of location updates.

Discussion

Call this method whenever your code no longer needs to receive location-related events. Disabling event delivery gives the receiver the option of disabling the appropriate hardware (and thereby saving power) when no clients need location data. You can always restart the generation of location updates by calling the CLLocationManager.StartUpdatingLocation method again.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/stopUpdatingLocation()

type CLLocationManagerClass

type CLLocationManagerClass struct {
	// contains filtered or unexported fields
}

func GetCLLocationManagerClass

func GetCLLocationManagerClass() CLLocationManagerClass

GetCLLocationManagerClass returns the class object for CLLocationManager.

func (CLLocationManagerClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLLocationManagerClass) Class

func (cc CLLocationManagerClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

func (CLLocationManagerClass) HeadingAvailable

func (_CLLocationManagerClass CLLocationManagerClass) HeadingAvailable() bool

Returns a Boolean value indicating whether the location manager is able to generate heading-related events.

Return Value

true if heading data is available; false if it is not.

Discussion

Heading data may not be available on all iOS-based devices. You should check the value returned by this method before asking the location manager to deliver heading-related events.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/headingAvailable()

func (CLLocationManagerClass) IsMonitoringAvailableForClass

func (_CLLocationManagerClass CLLocationManagerClass) IsMonitoringAvailableForClass(regionClass objectivec.Class) bool

Returns a Boolean value indicating whether the device supports region monitoring using the specified class.

regionClass: A region monitoring class from the MapKit framework. This class must descend from the CLRegion class.

Return Value

true if the device is capable of monitoring regions using the specified class or false if it is not.

Discussion

The availability of region monitoring support is dependent on the hardware present on the device. This method does not take into account the availability of location services or the fact that the user might have disabled them for the app or system; you must determine your app’s authorization status separately.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/isMonitoringAvailable(for:)

func (CLLocationManagerClass) IsRangingAvailable

func (_CLLocationManagerClass CLLocationManagerClass) IsRangingAvailable() bool

Returns a Boolean value indicating whether the device supports ranging of beacons that use the iBeacon protocol.

Return Value

true if the device supports ranging or false if it does not.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/isRangingAvailable()

func (CLLocationManagerClass) LocationServicesEnabled

func (_CLLocationManagerClass CLLocationManagerClass) LocationServicesEnabled() bool

Returns a Boolean value indicating whether location services are enabled on the device.

Return Value

true if location services are enabled on the device; false if they are not.

Discussion

Users can enable or disable location services by toggling the Location Services switch in Settings > Privacy.

- When users disable the switch, the system calls your delegate’s locationManager(_:didChangeAuthorization:) method with a denied authorization status (KCLAuthorizationStatusDenied). - When users enable the switch, the system returns your app’s authorization to its previous state and calls your delegate’s locationManager(_:didChangeAuthorization:) method.

You are not required to call CLLocationManagerClass.LocationServicesEnabled. However, If you wish to display instructions about enabling location services, you may check the return value of this method to find out if the services are disabled for the entire device, or just for your app. If the result is `true`, provide instructions for enabling services for your app; otherwise, provide instructions for enabling the Location Services switch in Settings > Privacy.

If users disable or deny location services and you attempt to start location updates anyway, the location manager reports an error to its delegate. See [LocationManagerDidFailWithError] and [LocationManagerMonitoringDidFailForRegionWithError] for more information.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/locationServicesEnabled()

func (CLLocationManagerClass) SignificantLocationChangeMonitoringAvailable

func (_CLLocationManagerClass CLLocationManagerClass) SignificantLocationChangeMonitoringAvailable() bool

Returns a Boolean value indicating whether the significant-change location service is available on the device.

Return Value

true if location change monitoring is available; false if it is not.

Discussion

This method indicates whether the device is able to report updates based on significant location changes only. This capability provides tremendous power savings for apps that want to track a user’s approximate location and don’t need highly accurate position information.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager/significantLocationChangeMonitoringAvailable()

type CLLocationManagerDelegate

type CLLocationManagerDelegate interface {
	objectivec.IObject
}

The methods you use to receive events from an associated location-manager object.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate

type CLLocationManagerDelegateConfig

type CLLocationManagerDelegateConfig struct {

	// Responding to authorization changes
	// LocationManagerDidChangeAuthorization — Tells the delegate when the app creates the location manager and when the authorization status changes.
	LocationManagerDidChangeAuthorization func(manager CLLocationManager)

	// Handling errors
	// LocationManagerDidFailWithError — Tells the delegate that the location manager was unable to retrieve a location value.
	LocationManagerDidFailWithError func(manager CLLocationManager, error_ foundation.NSError)

	// Receiving location updates
	// LocationManagerDidFinishDeferredUpdatesWithError — Tells the delegate that updates will no longer be deferred.
	LocationManagerDidFinishDeferredUpdatesWithError func(manager CLLocationManager, error_ foundation.NSError)

	// Pausing location updates
	// LocationManagerDidPauseLocationUpdates — Tells the delegate that location updates were paused.
	LocationManagerDidPauseLocationUpdates func(manager CLLocationManager)
	// LocationManagerDidResumeLocationUpdates — Tells the delegate that the delivery of location updates has resumed.
	LocationManagerDidResumeLocationUpdates func(manager CLLocationManager)

	// Receiving visit updates
	// LocationManagerDidVisit — Tells the delegate that a new visit-related event was received.
	LocationManagerDidVisit func(manager CLLocationManager, visit CLVisit)

	// Receiving heading updates
	// LocationManagerDidUpdateHeading — Tells the delegate that the location manager received updated heading information.
	LocationManagerDidUpdateHeading func(manager CLLocationManager, newHeading CLHeading)
	// LocationManagerShouldDisplayHeadingCalibration — Asks the delegate whether the heading calibration alert should be displayed.
	LocationManagerShouldDisplayHeadingCalibration func(manager CLLocationManager) bool

	// Receiving region-related updates
	// LocationManagerDidEnterRegion — Tells the delegate that the user entered the specified region.
	LocationManagerDidEnterRegion func(manager CLLocationManager, region CLRegion)
	// LocationManagerDidExitRegion — Tells the delegate that the user left the specified region.
	LocationManagerDidExitRegion func(manager CLLocationManager, region CLRegion)

	// Other Methods
	// LocationManagerDidUpdateToLocationFromLocation — Tells the delegate that a new location value is available.
	LocationManagerDidUpdateToLocationFromLocation func(manager CLLocationManager, newLocation CLLocation, oldLocation CLLocation)
	// LocationManagerDidDetermineStateForRegion — Tells the delegate about the state of the specified region.
	LocationManagerDidDetermineStateForRegion func(manager CLLocationManager, state CLRegionState, region CLRegion)
	// LocationManagerMonitoringDidFailForRegionWithError — Tells the delegate that a region monitoring error occurred.
	LocationManagerMonitoringDidFailForRegionWithError func(manager CLLocationManager, region CLRegion, error_ foundation.NSError)
	// LocationManagerDidStartMonitoringForRegion — Tells the delegate that a new region is being monitored.
	LocationManagerDidStartMonitoringForRegion func(manager CLLocationManager, region CLRegion)
	// LocationManagerDidFailRangingBeaconsForConstraintError — Tells the delegate that the location manager couldn’t detect any beacons that satisfy the provided constraint.
	LocationManagerDidFailRangingBeaconsForConstraintError func(manager CLLocationManager, beaconConstraint CLBeaconIdentityConstraint, error_ foundation.NSError)
}

CLLocationManagerDelegateConfig holds optional typed callbacks for CLLocationManagerDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.

See Apple Documentation for protocol details.

type CLLocationManagerDelegateObject

type CLLocationManagerDelegateObject struct {
	objectivec.Object
}

CLLocationManagerDelegateObject wraps an existing Objective-C object that conforms to the CLLocationManagerDelegate protocol.

func CLLocationManagerDelegateObjectFromID

func CLLocationManagerDelegateObjectFromID(id objc.ID) CLLocationManagerDelegateObject

CLLocationManagerDelegateObjectFromID constructs a CLLocationManagerDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.

func NewCLLocationManagerDelegate

func NewCLLocationManagerDelegate(config CLLocationManagerDelegateConfig) CLLocationManagerDelegateObject

NewCLLocationManagerDelegate creates an Objective-C object implementing the CLLocationManagerDelegate protocol.

Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.

The returned CLLocationManagerDelegateObject satisfies the CLLocationManagerDelegate interface and can be passed directly to SetDelegate and similar methods.

See Apple Documentation for protocol details.

func (CLLocationManagerDelegateObject) BaseObject

func (CLLocationManagerDelegateObject) LocationManagerDidChangeAuthorization

func (o CLLocationManagerDelegateObject) LocationManagerDidChangeAuthorization(manager ICLLocationManager)

Tells the delegate when the app creates the location manager and when the authorization status changes.

manager: The location manager object reporting the event.

Discussion

The system calls this method when the app creates the related object’s CLLocationManager instance, and when the app’s authorization status changes. The status informs the app whether it can access the user’s location.

Use this delegate method to manage your app’s state changes in response to its ability to use location information. For example, you may wish to enable or disable your app’s location-related features, as appropriate. To determine the app’s current authorization, read the new value of the CLLocationManager.AuthorizationStatus and CLLocationManager.AccuracyAuthorization properties of the location manager.

If the user’s choice doesn’t change the authorization status after you call the CLLocationManager.RequestWhenInUseAuthorization or CLLocationManager.RequestAlwaysAuthorization method, the location manager doesn’t report the current authorization status to this method—the location manager only reports changes. For example, the location manager calls this method when the status changes from KCLAuthorizationStatusNotDetermined to KCLAuthorizationStatusAuthorizedWhenInUse.

Events that Cause Authorization Status Changes

An app’s authorization status changes in response to users’ actions. Users can change permission for apps to use location information at any time. The user can:

- Change an app’s location authorization in Settings > Privacy > Location Services, or in Settings > (the app) > Location Services. - Turn location services on or off globally in Settings > Privacy > Location Services. - Choose Reset Location & Privacy in Settings > General > Reset.

A user’s response to location manager prompts can also change authorization status. For instance, users may change the authorization status by responding to the prompts initiated by calls to CLLocationManager.RequestWhenInUseAuthorization or CLLocationManager.RequestAlwaysAuthorization methods. For apps with Always authorization, users may change the authorization status to When In Use when responding to the location usage reminder alert.

When an app has temporary authorization, the authorization changes when the user ceases to use the app.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManagerDidChangeAuthorization(_:)

func (CLLocationManagerDelegateObject) LocationManagerDidDetermineStateForRegion

func (o CLLocationManagerDelegateObject) LocationManagerDidDetermineStateForRegion(manager ICLLocationManager, state CLRegionState, region ICLRegion)

Tells the delegate about the state of the specified region.

manager: The location manager object reporting the event.

state: The state of the specified region. For a list of possible values, see the CLRegionState type.

region: The region whose state was determined.

Discussion

The location manager calls this method whenever there is a boundary transition for a region. It calls this method in addition to calling the [LocationManagerDidEnterRegion] and [LocationManagerDidExitRegion] methods. The location manager also calls this method in response to a call to its [CLLocationManager.RequestStateForRegion] method, which runs asynchronously.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didDetermineState:for:)

func (CLLocationManagerDelegateObject) LocationManagerDidEnterRegion

func (o CLLocationManagerDelegateObject) LocationManagerDidEnterRegion(manager ICLLocationManager, region ICLRegion)

Tells the delegate that the user entered the specified region.

manager: The location manager object reporting the event.

region: An object containing information about the region that was entered.

Discussion

Because regions are a shared application resource, every active location manager object delivers this message to its associated delegate. It doesn’t matter which location manager actually registered the specified region. If multiple location managers share a delegate object, that delegate receives the message multiple times.

The region object provided may not be the same one that was registered. As a result, you should never perform pointer-level comparisons to determine equality. Instead, use the region’s identifier string to determine if your delegate should respond.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didEnterRegion:)

func (CLLocationManagerDelegateObject) LocationManagerDidExitRegion

func (o CLLocationManagerDelegateObject) LocationManagerDidExitRegion(manager ICLLocationManager, region ICLRegion)

Tells the delegate that the user left the specified region.

manager: The location manager object reporting the event.

region: An object containing information about the region that was exited.

Discussion

Because regions are a shared application resource, every active location manager object delivers this message to its associated delegate. It doesn’t matter which location manager actually registered the specified region. If multiple location managers share a delegate object, that delegate receives the message multiple times.

The region object provided may not be the same one that was registered. As a result, you should never perform pointer-level comparisons to determine equality. Instead, use the region’s identifier string to determine if your delegate should respond.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didExitRegion:)

func (CLLocationManagerDelegateObject) LocationManagerDidFailRangingBeaconsForConstraintError

func (o CLLocationManagerDelegateObject) LocationManagerDidFailRangingBeaconsForConstraintError(manager ICLLocationManager, beaconConstraint ICLBeaconIdentityConstraint, error_ foundation.NSError)

Tells the delegate that the location manager couldn’t detect any beacons that satisfy the provided constraint.

manager: The CLLocationManager that corresponds to this delegate.

beaconConstraint: The CLBeaconIdentityConstraint that describes the characteristics of the beacons the location manager is looking for.

error: An NSError object that describes the error.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didFailRangingFor:error:)

func (CLLocationManagerDelegateObject) LocationManagerDidFailWithError

func (o CLLocationManagerDelegateObject) LocationManagerDidFailWithError(manager ICLLocationManager, error_ foundation.NSError)

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

manager: The location manager object that was unable to retrieve the location.

error: The error object containing the reason the location or heading could not be retrieved.

Discussion

If you do not implement this method, Core Location throws an exception when attempting to use location services.

The location manager calls this method when it encounters an error trying to get the location or heading data. If the location service is unable to retrieve a location right away, it reports a KCLErrorLocationUnknown error and keeps trying. In such a situation, you can simply ignore the error and wait for a new event. If a heading could not be determined because of strong interference from nearby magnetic fields, this method returns KCLErrorHeadingFailure.

If the user denies your app’s use of the location service, this method reports a KCLErrorDenied error. Upon receiving such an error, you should stop the location service.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didFailWithError:)

func (CLLocationManagerDelegateObject) LocationManagerDidFinishDeferredUpdatesWithError

func (o CLLocationManagerDelegateObject) LocationManagerDidFinishDeferredUpdatesWithError(manager ICLLocationManager, error_ foundation.NSError)

Tells the delegate that updates will no longer be deferred.

manager: The location manager object that generated the update event.

error: The error object containing the reason deferred location updates could not be delivered.

Discussion

The location manager object calls this method to let you know that it has stopped deferring the delivery of location events. The manager may call this method for any number of reasons. For example, it calls it when you stop location updates altogether, when you ask the location manager to disallow deferred updates, or when a condition for deferring updates (such as exceeding a timeout or distance parameter) is met.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didFinishDeferredUpdatesWithError:)

func (CLLocationManagerDelegateObject) LocationManagerDidPauseLocationUpdates

func (o CLLocationManagerDelegateObject) LocationManagerDidPauseLocationUpdates(manager ICLLocationManager)

Tells the delegate that location updates were paused.

manager: The location manager object that paused the delivery of events.

Discussion

When the location manager detects that the device’s location is not changing, it can pause the delivery of updates in order to shut down the appropriate hardware and save power. When it does this, it calls this method to let your app know that this has happened.

After a pause occurs, it is your responsibility to restart location services again at an appropriate time. You might use your implementation of this method to start region monitoring at the user’s current location or enable the visits location service to determine when the user starts moving again. Another alternative is to restart location services immediately with a reduced accuracy (which can save power) and then return to a greater accuracy only after the user starts moving again.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManagerDidPauseLocationUpdates(_:)

func (CLLocationManagerDelegateObject) LocationManagerDidRangeBeaconsSatisfyingConstraint

func (o CLLocationManagerDelegateObject) LocationManagerDidRangeBeaconsSatisfyingConstraint(manager ICLLocationManager, beacons []CLBeacon, beaconConstraint ICLBeaconIdentityConstraint)

Tells the delegate that the location manager detected at least one beacon that satisfies the provided constraint.

manager: The CLLocationManager that corresponds to this delegate.

beacons: An array of CLBeacon objects.

beaconConstraint: The CLBeaconIdentityConstraint that describes the characteristics of the beacons the location manager is looking for.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didRange:satisfying:)

func (CLLocationManagerDelegateObject) LocationManagerDidResumeLocationUpdates

func (o CLLocationManagerDelegateObject) LocationManagerDidResumeLocationUpdates(manager ICLLocationManager)

Tells the delegate that the delivery of location updates has resumed.

manager: The location manager that resumed the delivery of events.

Discussion

When you restart location services after an automatic pause, Core Location calls this method to notify your app that services have resumed. You are responsible for restarting location services in your app. Core Location does not resume updates automatically after it pauses them. For tips on how to restart location services when a pause occurs, see the discussion of the [LocationManagerDidPauseLocationUpdates] method.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManagerDidResumeLocationUpdates(_:)

func (CLLocationManagerDelegateObject) LocationManagerDidStartMonitoringForRegion

func (o CLLocationManagerDelegateObject) LocationManagerDidStartMonitoringForRegion(manager ICLLocationManager, region ICLRegion)

Tells the delegate that a new region is being monitored.

manager: The location manager object reporting the event.

region: The region that is being monitored.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didStartMonitoringFor:)

func (CLLocationManagerDelegateObject) LocationManagerDidUpdateHeading

func (o CLLocationManagerDelegateObject) LocationManagerDidUpdateHeading(manager ICLLocationManager, newHeading ICLHeading)

Tells the delegate that the location manager received updated heading information.

manager: The location manager object that generated the update event.

newHeading: The new heading data.

Discussion

Implementation of this method is optional but expected if you start heading updates using the CLLocationManager.StartUpdatingHeading method.

The location manager object calls this method after you initially start the heading service. Subsequent events are delivered when the previously reported value changes by more than the value specified in the CLLocationManager.HeadingFilter property of the location manager object.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didUpdateHeading:)

func (CLLocationManagerDelegateObject) LocationManagerDidUpdateLocations

func (o CLLocationManagerDelegateObject) LocationManagerDidUpdateLocations(manager ICLLocationManager, locations []CLLocation)

Tells the delegate that new location data is available.

manager: The location manager object that generated the update event.

locations: An array of CLLocation objects containing the location data. This array always contains at least one object representing the current location. If updates were deferred or if multiple locations arrived before they could be delivered, the array may contain additional entries. The objects in the array are organized in the order in which they occurred. Therefore, the most recent location update is at the end of the array.

Discussion

Implementation of this method is optional but recommended.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didUpdateLocations:)

func (CLLocationManagerDelegateObject) LocationManagerDidUpdateToLocationFromLocation

func (o CLLocationManagerDelegateObject) LocationManagerDidUpdateToLocationFromLocation(manager ICLLocationManager, newLocation ICLLocation, oldLocation ICLLocation)

Tells the delegate that a new location value is available.

manager: The location manager object that generated the update event.

newLocation: The new location data.

oldLocation: The location data from the previous update. If this is the first update event delivered by this location manager, this parameter is `nil`.

Discussion

By the time this message is delivered to your delegate, the new location data is also available directly from the CLLocationManager object. The `newLocation` parameter may contain the data that was cached from a previous usage of the location service. You can use the CLLocation.Timestamp property of the location object to determine how recent the location data is.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didUpdateTo:from:)

func (CLLocationManagerDelegateObject) LocationManagerDidVisit

func (o CLLocationManagerDelegateObject) LocationManagerDidVisit(manager ICLLocationManager, visit ICLVisit)

Tells the delegate that a new visit-related event was received.

manager: The location manager object reporting the event.

visit: The visit object that contains the information about the event.

Discussion

The location manager calls this method whenever it has new visit event to report to your app.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didVisit:)

func (CLLocationManagerDelegateObject) LocationManagerMonitoringDidFailForRegionWithError

func (o CLLocationManagerDelegateObject) LocationManagerMonitoringDidFailForRegionWithError(manager ICLLocationManager, region ICLRegion, error_ foundation.NSError)

Tells the delegate that a region monitoring error occurred.

manager: The location manager object reporting the event.

region: The region for which the error occurred.

error: An error object containing the error code that indicates why region monitoring failed.

Discussion

If an error occurs while trying to monitor a given region, the location manager sends this message to its delegate. Region monitoring might fail because the region itself cannot be monitored or because there was a more general failure in configuring the region monitoring service.

Although implementation of this method is optional, it is recommended that you implement it if you use region monitoring in your application.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:monitoringDidFailFor:withError:)

func (CLLocationManagerDelegateObject) LocationManagerShouldDisplayHeadingCalibration

func (o CLLocationManagerDelegateObject) LocationManagerShouldDisplayHeadingCalibration(manager ICLLocationManager) bool

Asks the delegate whether the heading calibration alert should be displayed.

manager: The location manager object coordinating the display of the heading calibration alert.

Return Value

true if you want to allow the heading calibration alert to be displayed; false if you do not.

Discussion

Core Location may call this method in an effort to calibrate the onboard hardware used to determine heading values. Typically, Core Location calls this method at the following times:

- The first time heading updates are ever requested - When Core Location observes a significant change in magnitude or inclination of the observed magnetic field

If you return true from this method, Core Location displays the heading calibration alert on top of the current window immediately. The calibration alert prompts the user to move the device in a particular pattern so that Core Location can distinguish between the Earth’s magnetic field and any local magnetic fields. The alert remains visible until calibration is complete or until you explicitly dismiss it by calling the CLLocationManager.DismissHeadingCalibrationDisplay method. In the latter case, you can use this method to set up a timer and dismiss the interface after a specified amount of time has elapsed.

If you return false from this method or do not provide an implementation for it in your delegate, Core Location does not display the heading calibration alert. Even if the alert is not displayed, calibration can still occur naturally when any interfering magnetic fields move away from the device. However, if the device is unable to calibrate itself for any reason, the value in the CLHeading.HeadingAccuracy property of any subsequent events will reflect the uncalibrated readings.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManagerDelegate/locationManagerShouldDisplayHeadingCalibration(_:)

type CLLocationPushServiceError

type CLLocationPushServiceError int

See: https://developer.apple.com/documentation/CoreLocation/CLLocationPushServiceError-swift.struct/Code

const (
	// CLLocationPushServiceErrorMissingEntitlement: An error code that indicates the app is missing the entitlement it needs to use the location push service.
	CLLocationPushServiceErrorMissingEntitlement CLLocationPushServiceError = 3
	// CLLocationPushServiceErrorMissingPushExtension: An error code that indicates the app is missing a Location Push Service Extension.
	CLLocationPushServiceErrorMissingPushExtension CLLocationPushServiceError = 1
	// CLLocationPushServiceErrorMissingPushServerEnvironment: An error code that indicates the app is missing an Apple Push Notification service (APNs) environment entitlement.
	CLLocationPushServiceErrorMissingPushServerEnvironment CLLocationPushServiceError = 2
	// CLLocationPushServiceErrorUnknown: An error code that indicates the app was unable to start the location push service for an unknown reason.
	CLLocationPushServiceErrorUnknown CLLocationPushServiceError = 0
	// CLLocationPushServiceErrorUnsupportedPlatform: An error code that indicates the location push service isn’t available on this platform.
	CLLocationPushServiceErrorUnsupportedPlatform CLLocationPushServiceError = 4
)

func (CLLocationPushServiceError) String

type CLLocationSourceInformation

type CLLocationSourceInformation struct {
	objectivec.Object
}

Information about the source that provides a location.

Overview

CLLocationSourceInformation contains information about the source that provides a CLLocation instance, such as instances that [LocationManagerDidUpdateLocations] delivers. For example, an app may choose to check the source information and reject locations if the CLLocationSourceInformation.IsSimulatedBySoftware property is `true` when the developer isn’t debugging or testing the app.

Creating a location source information object

Identifying the source of location data

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLLocationSourceInformation

func CLLocationSourceInformationFromID

func CLLocationSourceInformationFromID(id objc.ID) CLLocationSourceInformation

CLLocationSourceInformationFromID constructs a CLLocationSourceInformation from an objc.ID.

Information about the source that provides a location.

func NewCLLocationSourceInformation

func NewCLLocationSourceInformation() CLLocationSourceInformation

NewCLLocationSourceInformation creates a new CLLocationSourceInformation instance.

func NewLocationSourceInformationWithSoftwareSimulationStateAndExternalAccessoryState

func NewLocationSourceInformationWithSoftwareSimulationStateAndExternalAccessoryState(isSoftware bool, isAccessory bool) CLLocationSourceInformation

Creates an instance of location source information.

isSoftware: A Boolean value that indicates software is generating or simulating the location information.

isAccessory: A Boolean value that indicates an external device is providing the location information.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationSourceInformation/init(softwareSimulationState:andExternalAccessoryState:)

func (CLLocationSourceInformation) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (CLLocationSourceInformation) EncodeWithCoder

func (l CLLocationSourceInformation) EncodeWithCoder(coder foundation.INSCoder)

func (CLLocationSourceInformation) Init

Init initializes the instance.

func (CLLocationSourceInformation) InitWithSoftwareSimulationStateAndExternalAccessoryState

func (l CLLocationSourceInformation) InitWithSoftwareSimulationStateAndExternalAccessoryState(isSoftware bool, isAccessory bool) CLLocationSourceInformation

Creates an instance of location source information.

isSoftware: A Boolean value that indicates software is generating or simulating the location information.

isAccessory: A Boolean value that indicates an external device is providing the location information.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationSourceInformation/init(softwareSimulationState:andExternalAccessoryState:)

func (CLLocationSourceInformation) IsProducedByAccessory

func (l CLLocationSourceInformation) IsProducedByAccessory() bool

A Boolean value that indicates whether the system receives the location from an external accessory.

Discussion

Core Location sets CLLocationSourceInformation.IsProducedByAccessory to `true` if the system retrieved the location from an external accessory attached to the device, such as a Made for iPhone GPS dongle or CarPlay. Otherwise, the default value is `false`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationSourceInformation/isProducedByAccessory

func (CLLocationSourceInformation) IsSimulatedBySoftware

func (l CLLocationSourceInformation) IsSimulatedBySoftware() bool

A Boolean value that indicates whether the system generates the location using on-device software simulation.

Discussion

Core Location sets CLLocationSourceInformation.IsSimulatedBySoftware to `true` if the system generated the location using on-device software simulation. You can simulate locations by loading GPX files using the Xcode debugger. The default value is `false`.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationSourceInformation/isSimulatedBySoftware

type CLLocationSourceInformationClass

type CLLocationSourceInformationClass struct {
	// contains filtered or unexported fields
}

func GetCLLocationSourceInformationClass

func GetCLLocationSourceInformationClass() CLLocationSourceInformationClass

GetCLLocationSourceInformationClass returns the class object for CLLocationSourceInformation.

func (CLLocationSourceInformationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLLocationSourceInformationClass) Class

Class returns the underlying Objective-C class pointer.

type CLLocationSpeed

type CLLocationSpeed = float64

CLLocationSpeed is the velocity (measured in meters per second) at which the device is moving.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationSpeed

type CLLocationSpeedAccuracy

type CLLocationSpeedAccuracy = float64

CLLocationSpeedAccuracy is the accuracy of a speed.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationSpeedAccuracy

type CLLocationUpdater

type CLLocationUpdater struct {
	objectivec.Object
}

An object that provides device location updates.

Controlling the updater

See: https://developer.apple.com/documentation/CoreLocation/CLLocationUpdater

func CLLocationUpdaterFromID

func CLLocationUpdaterFromID(id objc.ID) CLLocationUpdater

CLLocationUpdaterFromID constructs a CLLocationUpdater from an objc.ID.

An object that provides device location updates.

func NewCLLocationUpdater

func NewCLLocationUpdater() CLLocationUpdater

NewCLLocationUpdater creates a new CLLocationUpdater instance.

func (CLLocationUpdater) Autorelease

func (l CLLocationUpdater) Autorelease() CLLocationUpdater

Autorelease adds the receiver to the current autorelease pool.

func (CLLocationUpdater) Init

Init initializes the instance.

func (CLLocationUpdater) Invalidate

func (l CLLocationUpdater) Invalidate()

Invalidates the updater.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationUpdater/invalidate

func (CLLocationUpdater) Pause

func (l CLLocationUpdater) Pause()

Pauses the updater.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationUpdater/pause

func (CLLocationUpdater) Resume

func (l CLLocationUpdater) Resume()

Resumes the updater.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationUpdater/resume

type CLLocationUpdaterClass

type CLLocationUpdaterClass struct {
	// contains filtered or unexported fields
}

func GetCLLocationUpdaterClass

func GetCLLocationUpdaterClass() CLLocationUpdaterClass

GetCLLocationUpdaterClass returns the class object for CLLocationUpdater.

func (CLLocationUpdaterClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLLocationUpdaterClass) Class

func (cc CLLocationUpdaterClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

func (CLLocationUpdaterClass) LiveUpdaterWithConfigurationQueueHandler

func (_CLLocationUpdaterClass CLLocationUpdaterClass) LiveUpdaterWithConfigurationQueueHandler(configuration CLLiveUpdateConfiguration, queue dispatch.Queue, handler CLUpdateHandler) CLLocationUpdater

Creates a location updater with the configuration and queue that you specify.

configuration: Specifies the live update configuration that the framework uses.

queue: Specifies the queue to which the framework submits the handler with each available update.

handler: The block that the framework invokes with each update.

Return Value

Returns a location updater instance with the specified configuration, queue, and update handler.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationUpdater/liveUpdaterWithConfiguration:queue:handler:

func (CLLocationUpdaterClass) LiveUpdaterWithConfigurationQueueHandlerSync

func (lc CLLocationUpdaterClass) LiveUpdaterWithConfigurationQueueHandlerSync(ctx context.Context, configuration CLLiveUpdateConfiguration, queue dispatch.Queue) (*CLUpdate, error)

LiveUpdaterWithConfigurationQueueHandlerSync is a synchronous wrapper around [CLLocationUpdater.LiveUpdaterWithConfigurationQueueHandler]. It blocks until the completion handler fires or the context is cancelled.

func (CLLocationUpdaterClass) LiveUpdaterWithQueueHandler

func (_CLLocationUpdaterClass CLLocationUpdaterClass) LiveUpdaterWithQueueHandler(queue dispatch.Queue, handler CLUpdateHandler) CLLocationUpdater

Creates a location updater on the queue you specify.

queue: Specifies the queue to which the framework submits the handler with each available update

handler: The block that the framework invokes with each update.

Return Value

Returns a location updater instance with the specified queue and update handler.

See: https://developer.apple.com/documentation/CoreLocation/CLLocationUpdater/liveUpdaterWithQueue:handler:

func (CLLocationUpdaterClass) LiveUpdaterWithQueueHandlerSync

func (lc CLLocationUpdaterClass) LiveUpdaterWithQueueHandlerSync(ctx context.Context, queue dispatch.Queue) (*CLUpdate, error)

LiveUpdaterWithQueueHandlerSync is a synchronous wrapper around [CLLocationUpdater.LiveUpdaterWithQueueHandler]. It blocks until the completion handler fires or the context is cancelled.

type CLMonitor

type CLMonitor struct {
	objectivec.Object
}

An object that monitors the conditions you add to it.

Overview

Use CLMonitor to monitor for and observe events such as the entry to a specific geographic area or proximity to a beacon with characteristics that you specify.

This service is unavailable in a compatible iPad or iPhone app running in visionOS.

Accessing the location monitor’s identifiers

Adding and removing conditions

See: https://developer.apple.com/documentation/CoreLocation/CLMonitor-6ynwz

func CLMonitorFromID

func CLMonitorFromID(id objc.ID) CLMonitor

CLMonitorFromID constructs a CLMonitor from an objc.ID.

An object that monitors the conditions you add to it.

func NewCLMonitor

func NewCLMonitor() CLMonitor

NewCLMonitor creates a new CLMonitor instance.

func (CLMonitor) AddConditionForMonitoringIdentifier

func (m CLMonitor) AddConditionForMonitoringIdentifier(condition ICLCondition, identifier string)

Adds a condition to monitor with the identifier you provide.

condition: A CLCondition to monitor for.

identifier: A string you use to identify this condition.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitor-6ynwz/addConditionForMonitoring:identifier:

func (CLMonitor) AddConditionForMonitoringIdentifierAssumedState

func (m CLMonitor) AddConditionForMonitoringIdentifierAssumedState(condition ICLCondition, identifier string, state CLMonitoringState)

Adds a condition to monitor with the state and identifier you provide.

condition: A CLCondition to monitor for.

identifier: A string you use to identify this condition.

state: A CLMonitoringState that satisfies `condition`.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitor-6ynwz/addConditionForMonitoring:identifier:assumedState:

func (CLMonitor) Autorelease

func (m CLMonitor) Autorelease() CLMonitor

Autorelease adds the receiver to the current autorelease pool.

func (CLMonitor) Init

func (m CLMonitor) Init() CLMonitor

Init initializes the instance.

func (CLMonitor) MonitoredIdentifiers

func (m CLMonitor) MonitoredIdentifiers() []string

An array that contains all the identifiers for each condition that the monitor is monitoring.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitor-6ynwz/monitoredIdentifiers

func (CLMonitor) MonitoringRecordForIdentifier

func (m CLMonitor) MonitoringRecordForIdentifier(identifier string) ICLMonitoringRecord

Gets the monitoring record containing the condition and most recent monitoring event for the identifier you supply, if applicable.

identifier: A string that identifies the monitoring record.

Return Value

The monitoring record; otherwise, nil.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitor-6ynwz/monitoringRecordForIdentifier:

func (CLMonitor) Name

func (m CLMonitor) Name() string

The name associated with the location monitor instance.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitor-6ynwz/name

func (CLMonitor) RemoveConditionFromMonitoringWithIdentifier

func (m CLMonitor) RemoveConditionFromMonitoringWithIdentifier(identifier string)

Removes the monitoring record with the identifier from monitoring.

identifier: A string that identifies the monitoring record.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitor-6ynwz/removeConditionFromMonitoringWithIdentifier:

type CLMonitorCLMonitoringEventHandler

type CLMonitorCLMonitoringEventHandler = func(*CLMonitor, *CLMonitoringEvent)

CLMonitorCLMonitoringEventHandler is the signature for a completion handler block.

Used by:

  • [CLMonitorConfiguration.ConfigWithMonitorNameQueueEventHandler]

type CLMonitorClass

type CLMonitorClass struct {
	// contains filtered or unexported fields
}

func GetCLMonitorClass

func GetCLMonitorClass() CLMonitorClass

GetCLMonitorClass returns the class object for CLMonitor.

func (CLMonitorClass) Alloc

func (cc CLMonitorClass) Alloc() CLMonitor

Alloc allocates memory for a new instance of the class.

func (CLMonitorClass) Class

func (cc CLMonitorClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

func (CLMonitorClass) RequestMonitorWithConfigurationCompletion

func (_CLMonitorClass CLMonitorClass) RequestMonitorWithConfigurationCompletion(config ICLMonitorConfiguration, completionHandler CLMonitorHandler)

Creates a location monitor with the configuration and event handler you provide.

config: The configuration that describes the conditions that satisfy this location monitor.

completionHandler: The handler the framework calls with events that satisfy the monitor’s conditions.

Discussion

Configure the location monitor by adding or removing conditions for monitoring by this instance of CLMonitor. When an event occurs, the framework calls the block you pass in on the specified queue and delivers an instance of CLMonitoringEvent. The event contains the identifier for the condition you’re monitoring, an optional instance of CLCondition containing specifics, the new state, and the event’s timestamp.

All interaction directly with the returned CLMonitor needs to occur on the specified queue. Failing to do so results in undefined behavior.

Conditions you add to an instance of CLMonitor persist until you remove them from monitoring. However, Core Location stops monitoring conditions if an event is pending for them, and there isn’t a configured CLMonitor to receive it.

The framework stores conditions in an opaque file at `~/Library/CoreLocation/BundleId`. Alternatively, you can access the conditions in the file at `~/Library/CoreLocation/`process name`/name.monitor`. You can determine your app’s process name using the ActivityMonitor app or by using the UNIX `ps -al` command in Terminal.

Note that for containerized apps, this is inside the data container. Apps need to observe when protected data becomes available using protectedDataDidBecomeAvailableNotification before creating a CLMonitor instance. Persistence of conditions enables an app to query efficiently for conditions it’s currently monitoring and the most recent event it delivers for each.

The app can choose to initialize the monitoring state for a condition. By default, the monitoring state is CLMonitoringStateUnknown.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitor-6ynwz/requestMonitorWithConfiguration:completion:

func (CLMonitorClass) RequestMonitorWithConfigurationCompletionSync

func (mc CLMonitorClass) RequestMonitorWithConfigurationCompletionSync(ctx context.Context, config ICLMonitorConfiguration) (*CLMonitor, error)

RequestMonitorWithConfigurationCompletionSync is a synchronous wrapper around [CLMonitor.RequestMonitorWithConfigurationCompletion]. It blocks until the completion handler fires or the context is cancelled.

type CLMonitorConfiguration

type CLMonitorConfiguration struct {
	objectivec.Object
}

An object for configuring a location monitor instance.

Instance properties

See: https://developer.apple.com/documentation/CoreLocation/CLMonitorConfiguration

func CLMonitorConfigurationFromID

func CLMonitorConfigurationFromID(id objc.ID) CLMonitorConfiguration

CLMonitorConfigurationFromID constructs a CLMonitorConfiguration from an objc.ID.

An object for configuring a location monitor instance.

func NewCLMonitorConfiguration

func NewCLMonitorConfiguration() CLMonitorConfiguration

NewCLMonitorConfiguration creates a new CLMonitorConfiguration instance.

func (CLMonitorConfiguration) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (CLMonitorConfiguration) EventHandler

The block the framework calls as the event handler for the location monitor instance.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitorConfiguration/eventHandler

func (CLMonitorConfiguration) Init

Init initializes the instance.

func (CLMonitorConfiguration) Name

func (m CLMonitorConfiguration) Name() string

The name of the monitor instance.

Discussion

`name` can contain only alphanumeric characters and can’t start with an underscore (_).

See: https://developer.apple.com/documentation/CoreLocation/CLMonitorConfiguration/name

func (CLMonitorConfiguration) Queue

The dispatch queue to bind the instance of a location monitor to.

Discussion

You need to perform all interactions related to the CLMonitor instance on this queue, and the framework delivers events that the CLMonitor instance generates to the handler on this queue.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitorConfiguration/queue

type CLMonitorConfigurationClass

type CLMonitorConfigurationClass struct {
	// contains filtered or unexported fields
}

func GetCLMonitorConfigurationClass

func GetCLMonitorConfigurationClass() CLMonitorConfigurationClass

GetCLMonitorConfigurationClass returns the class object for CLMonitorConfiguration.

func (CLMonitorConfigurationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLMonitorConfigurationClass) Class

Class returns the underlying Objective-C class pointer.

func (CLMonitorConfigurationClass) ConfigWithMonitorNameQueueEventHandler

func (_CLMonitorConfigurationClass CLMonitorConfigurationClass) ConfigWithMonitorNameQueueEventHandler(name string, queue dispatch.Queue, eventHandler CLMonitorCLMonitoringEventHandler) CLMonitorConfiguration

Creates a location monitor instance with the name, dispatch queue, and event handler you specify.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitorConfiguration/configWithMonitorName:queue:eventHandler:

type CLMonitorHandler

type CLMonitorHandler = func(*CLMonitor)

CLMonitorHandler handles The handler the framework calls with events that satisfy the monitor’s conditions.

Used by:

  • [CLMonitor.RequestMonitorWithConfigurationCompletion]

type CLMonitoringEvent

type CLMonitoringEvent struct {
	objectivec.Object
}

The object that the framework passes to the monitor’s callback handler upon receiving an event.

Overview

Instances of CLMonitoringEvent contain detailed information about an event in the monitoring of a CLCondition by a CLMonitor.

Event states

Event properties

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent

func CLMonitoringEventFromID

func CLMonitoringEventFromID(id objc.ID) CLMonitoringEvent

CLMonitoringEventFromID constructs a CLMonitoringEvent from an objc.ID.

The object that the framework passes to the monitor’s callback handler upon receiving an event.

func NewCLMonitoringEvent

func NewCLMonitoringEvent() CLMonitoringEvent

NewCLMonitoringEvent creates a new CLMonitoringEvent instance.

func (CLMonitoringEvent) AccuracyLimited

func (m CLMonitoringEvent) AccuracyLimited() bool

A Boolean value that indicates whether the app receives accuracy-limited location updates.

Discussion

If this property is true, then the app receives accuracy-limited location updates.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/accuracyLimited

func (CLMonitoringEvent) AuthorizationDenied

func (m CLMonitoringEvent) AuthorizationDenied() bool

A Boolean value that indicates whether the app has local authorization.

Discussion

If this property is true, then the app isn’t receiving location updates because it’s denied local authorization.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/authorizationDenied

func (CLMonitoringEvent) AuthorizationDeniedGlobally

func (m CLMonitoringEvent) AuthorizationDeniedGlobally() bool

A Boolean value that indicates whether the app has system-wide authorization.

Discussion

If this property is true, then the app isn’t receiving location updates because it’s denied system-wide authorization.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/authorizationDeniedGlobally

func (CLMonitoringEvent) AuthorizationRestricted

func (m CLMonitoringEvent) AuthorizationRestricted() bool

A Boolean value that indicates whether the app can make authorization changes.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/authorizationRestricted

func (CLMonitoringEvent) Autorelease

func (m CLMonitoringEvent) Autorelease() CLMonitoringEvent

Autorelease adds the receiver to the current autorelease pool.

func (CLMonitoringEvent) ConditionLimitExceeded

func (m CLMonitoringEvent) ConditionLimitExceeded() bool

A Boolean value that indicates whether the app receives location updates based on other monitoring conditions.

Discussion

If this property is true, then the app isn’t receiving location updates because it’s monitoring too many other conditions of this type.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/conditionLimitExceeded

func (CLMonitoringEvent) ConditionUnsupported

func (m CLMonitoringEvent) ConditionUnsupported() bool

A Boolean value that indicates whether the app receives location updates based on the supported condition.

Discussion

If this property is true, then the app isn’t receiving location updates because it’s monitoring a type of condition that isn’t supported.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/conditionUnsupported

func (CLMonitoringEvent) Date

The date the event occurs.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/date

func (CLMonitoringEvent) EncodeWithCoder

func (m CLMonitoringEvent) EncodeWithCoder(coder foundation.INSCoder)

func (CLMonitoringEvent) Identifier

func (m CLMonitoringEvent) Identifier() string

A string that represents the identifier of a monitored condition.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/identifier

func (CLMonitoringEvent) Init

Init initializes the instance.

func (CLMonitoringEvent) InsufficientlyInUse

func (m CLMonitoringEvent) InsufficientlyInUse() bool

A Boolean value that indicates whether the app receives location updates because it’s insufficiently in use.

Discussion

If this property is true, then the app isn’t receiving location updates because it’s insufficiently in use.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/insufficientlyInUse

func (CLMonitoringEvent) PersistenceUnavailable

func (m CLMonitoringEvent) PersistenceUnavailable() bool

A Boolean value that indicates whether it receives location updates based on successful persistence.

Discussion

If this property is true, then location updates are suspended because the app has a persistence failure.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/persistenceUnavailable

func (CLMonitoringEvent) Refinement

func (m CLMonitoringEvent) Refinement() ICLCondition

An optional instance of a condition that represents the most specific condition to that this event can apply to.

Discussion

The type of the refinement condition depends on the monitored condition itself.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/refinement

func (CLMonitoringEvent) State

The state of the condition at the time of the event.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent/state

type CLMonitoringEventClass

type CLMonitoringEventClass struct {
	// contains filtered or unexported fields
}

func GetCLMonitoringEventClass

func GetCLMonitoringEventClass() CLMonitoringEventClass

GetCLMonitoringEventClass returns the class object for CLMonitoringEvent.

func (CLMonitoringEventClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLMonitoringEventClass) Class

func (cc CLMonitoringEventClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLMonitoringRecord

type CLMonitoringRecord struct {
	objectivec.Object
}

An object that represents a condition and its associated information that a location monitor is monitoring.

Overview

When handling a new CLMonitoringEvent, the CLMonitoringRecord available for the indicated identifier from the CLMonitor contains the prior event. The CLMonitoringRecord updates with the new event when the handling is complete.

Event properties

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringRecord

func CLMonitoringRecordFromID

func CLMonitoringRecordFromID(id objc.ID) CLMonitoringRecord

CLMonitoringRecordFromID constructs a CLMonitoringRecord from an objc.ID.

An object that represents a condition and its associated information that a location monitor is monitoring.

func NewCLMonitoringRecord

func NewCLMonitoringRecord() CLMonitoringRecord

NewCLMonitoringRecord creates a new CLMonitoringRecord instance.

func (CLMonitoringRecord) Autorelease

func (m CLMonitoringRecord) Autorelease() CLMonitoringRecord

Autorelease adds the receiver to the current autorelease pool.

func (CLMonitoringRecord) Condition

func (m CLMonitoringRecord) Condition() ICLCondition

The condition that the framework is monitoring events for.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringRecord/condition

func (CLMonitoringRecord) EncodeWithCoder

func (m CLMonitoringRecord) EncodeWithCoder(coder foundation.INSCoder)

func (CLMonitoringRecord) Init

Init initializes the instance.

func (CLMonitoringRecord) LastEvent

func (m CLMonitoringRecord) LastEvent() ICLMonitoringEvent

An object that contains the specifics of the most recent event.

Discussion

This includes the state, the date, and the specifics of the condition, if applicable.

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringRecord/lastEvent

type CLMonitoringRecordClass

type CLMonitoringRecordClass struct {
	// contains filtered or unexported fields
}

func GetCLMonitoringRecordClass

func GetCLMonitoringRecordClass() CLMonitoringRecordClass

GetCLMonitoringRecordClass returns the class object for CLMonitoringRecord.

func (CLMonitoringRecordClass) Alloc

Alloc allocates memory for a new instance of the class.

func (CLMonitoringRecordClass) Class

func (cc CLMonitoringRecordClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLMonitoringState

type CLMonitoringState uint

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringState

const (
	// CLMonitoringStateSatisfied: The condition is in a satisfied state.
	CLMonitoringStateSatisfied CLMonitoringState = 1
	// CLMonitoringStateUnknown: The condition is in an unknown state.
	CLMonitoringStateUnknown CLMonitoringState = 0
	// CLMonitoringStateUnmonitored: The condition is in an unmonitored state.
	CLMonitoringStateUnmonitored CLMonitoringState = 3
	// CLMonitoringStateUnsatisfied: The condition is in an unsatisfied state.
	CLMonitoringStateUnsatisfied CLMonitoringState = 2
)

func (CLMonitoringState) String

func (e CLMonitoringState) String() string

type CLPlacemark

type CLPlacemark struct {
	objectivec.Object
}

A user-friendly description of a geographic coordinate, often containing the name of the place, its address, and other relevant information.

Overview

A CLPlacemark object stores placemark data for a given latitude and longitude. Placemark data includes information such as the country or region, state, city, and street address associated with the specified coordinate. It can also include points of interest and geographically related data.

When you reverse geocode a geographic coordinate using a CLGeocoder object, you receive a CLPlacemark object containing the descriptive information for that location. You can also create CLPlacemark object and fill it with address information yourself, which you might do when you want to determine the geographic coordinate associated with the location.

See: https://developer.apple.com/documentation/CoreLocation/CLPlacemark

func CLPlacemarkFromID

func CLPlacemarkFromID(id objc.ID) CLPlacemark

CLPlacemarkFromID constructs a CLPlacemark from an objc.ID.

A user-friendly description of a geographic coordinate, often containing the name of the place, its address, and other relevant information.

func NewCLPlacemark

func NewCLPlacemark() CLPlacemark

NewCLPlacemark creates a new CLPlacemark instance.

func (CLPlacemark) Autorelease

func (p CLPlacemark) Autorelease() CLPlacemark

Autorelease adds the receiver to the current autorelease pool.

func (CLPlacemark) EncodeWithCoder

func (p CLPlacemark) EncodeWithCoder(coder foundation.INSCoder)

func (CLPlacemark) Init

func (p CLPlacemark) Init() CLPlacemark

Init initializes the instance.

type CLPlacemarkArrayErrorHandler

type CLPlacemarkArrayErrorHandler = func(*[]CLPlacemark, error)

CLPlacemarkArrayErrorHandler handles The handler block to execute with the results. The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.

Used by:

  • [CLGeocoder.GeocodeAddressStringCompletionHandler]
  • [CLGeocoder.GeocodeAddressStringInRegionCenteredAtInRegionRadiusPreferredLocaleCompletionHandler]
  • [CLGeocoder.GeocodeAddressStringInRegionCompletionHandler]
  • [CLGeocoder.GeocodeAddressStringInRegionPreferredLocaleCompletionHandler]
  • [CLGeocoder.GeocodePostalAddressCompletionHandler]
  • [CLGeocoder.GeocodePostalAddressPreferredLocaleCompletionHandler]
  • [CLGeocoder.ReverseGeocodeLocationCompletionHandler]
  • [CLGeocoder.ReverseGeocodeLocationPreferredLocaleCompletionHandler]

type CLPlacemarkClass

type CLPlacemarkClass struct {
	// contains filtered or unexported fields
}

func GetCLPlacemarkClass

func GetCLPlacemarkClass() CLPlacemarkClass

GetCLPlacemarkClass returns the class object for CLPlacemark.

func (CLPlacemarkClass) Alloc

func (cc CLPlacemarkClass) Alloc() CLPlacemark

Alloc allocates memory for a new instance of the class.

func (CLPlacemarkClass) Class

func (cc CLPlacemarkClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLProximity

type CLProximity int

See: https://developer.apple.com/documentation/CoreLocation/CLProximity

const (
	// CLProximityFar: The beacon is far away.
	CLProximityFar CLProximity = 3
	// CLProximityImmediate: The beacon is in the user’s immediate vicinity.
	CLProximityImmediate CLProximity = 1
	// CLProximityNear: The beacon is relatively close to the user.
	CLProximityNear CLProximity = 2
	// CLProximityUnknown: The proximity of the beacon could not be determined.
	CLProximityUnknown CLProximity = 0
)

func (CLProximity) String

func (e CLProximity) String() string

type CLRegion

type CLRegion struct {
	objectivec.Object
}

A base class representing an area that can be monitored.

Overview

This is an abstract base class. Instantiate one of the provided subclasses that define specific types of regions. After you create a region, register it with a CLLocationManager object with the [CLLocationManager.StartMonitoringForRegion] method. The location manager generates appropriate events whenever the user crosses the boundaries of the region.

Getting the region identifier

Specifying the notification conditions

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLRegion

func CLRegionFromID

func CLRegionFromID(id objc.ID) CLRegion

CLRegionFromID constructs a CLRegion from an objc.ID.

A base class representing an area that can be monitored.

func NewCLRegion

func NewCLRegion() CLRegion

NewCLRegion creates a new CLRegion instance.

func (CLRegion) Autorelease

func (r CLRegion) Autorelease() CLRegion

Autorelease adds the receiver to the current autorelease pool.

func (CLRegion) EncodeWithCoder

func (r CLRegion) EncodeWithCoder(coder foundation.INSCoder)

func (CLRegion) Identifier

func (r CLRegion) Identifier() string

The identifier for the region object.

Discussion

Use this value to identify this region inside your application.

See: https://developer.apple.com/documentation/CoreLocation/CLRegion/identifier

func (CLRegion) Init

func (r CLRegion) Init() CLRegion

Init initializes the instance.

func (CLRegion) NotifyOnEntry

func (r CLRegion) NotifyOnEntry() bool

A Boolean indicating that notifications are generated upon entry into the region.

Discussion

When this property is true, a device crossing from outside the region to inside the region triggers the delivery of a notification. If the property is false, a notification is not generated. The default value of this property is true.

If the app is not running when a boundary crossing occurs, the system launches the app into the background to handle it. Upon launch, your app must configure new location manager and delegate objects to receive the notification. The notification is sent to your delegate’s [LocationManagerDidEnterRegion] method.

See: https://developer.apple.com/documentation/CoreLocation/CLRegion/notifyOnEntry

func (CLRegion) NotifyOnExit

func (r CLRegion) NotifyOnExit() bool

A Boolean indicating that notifications are generated upon exit from the region.

Discussion

When this property is true, a device crossing from inside the region to outside the region triggers the delivery of a notification. If the property is false, a notification is not generated. The default value of this property is true.

If the app is not running when a boundary crossing occurs, the system launches the app into the background to handle it. Upon launch, your app must configure new location manager and delegate objects to receive the notification. The notification is sent to your delegate’s [LocationManagerDidExitRegion] method.

See: https://developer.apple.com/documentation/CoreLocation/CLRegion/notifyOnExit

func (CLRegion) SetNotifyOnEntry

func (r CLRegion) SetNotifyOnEntry(value bool)

func (CLRegion) SetNotifyOnExit

func (r CLRegion) SetNotifyOnExit(value bool)

type CLRegionClass

type CLRegionClass struct {
	// contains filtered or unexported fields
}

func GetCLRegionClass

func GetCLRegionClass() CLRegionClass

GetCLRegionClass returns the class object for CLRegion.

func (CLRegionClass) Alloc

func (cc CLRegionClass) Alloc() CLRegion

Alloc allocates memory for a new instance of the class.

func (CLRegionClass) Class

func (cc CLRegionClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLRegionState

type CLRegionState int

See: https://developer.apple.com/documentation/CoreLocation/CLRegionState

const (
	// CLRegionStateInside: The location is inside of the given region.
	CLRegionStateInside CLRegionState = 1
	// CLRegionStateOutside: The location is outside of the given region.
	CLRegionStateOutside CLRegionState = 2
	// CLRegionStateUnknown: It is unknown whether the location is inside or outside of the region.
	CLRegionStateUnknown CLRegionState = 0
)

func (CLRegionState) String

func (e CLRegionState) String() string

type CLServiceSessionAuthorizationRequirement

type CLServiceSessionAuthorizationRequirement int

See: https://developer.apple.com/documentation/CoreLocation/CLServiceSessionAuthorizationRequirement

const (
	CLServiceSessionAuthorizationRequirementAlways    CLServiceSessionAuthorizationRequirement = 2
	CLServiceSessionAuthorizationRequirementNone      CLServiceSessionAuthorizationRequirement = 0
	CLServiceSessionAuthorizationRequirementWhenInUse CLServiceSessionAuthorizationRequirement = 1
)

func (CLServiceSessionAuthorizationRequirement) String

type CLUpdate

type CLUpdate struct {
	objectivec.Object
}

An object that represents a location update.

Update properties

Instance Properties

See: https://developer.apple.com/documentation/CoreLocation/CLUpdate

func CLUpdateFromID

func CLUpdateFromID(id objc.ID) CLUpdate

CLUpdateFromID constructs a CLUpdate from an objc.ID.

An object that represents a location update.

func NewCLUpdate

func NewCLUpdate() CLUpdate

NewCLUpdate creates a new CLUpdate instance.

func (CLUpdate) Autorelease

func (u CLUpdate) Autorelease() CLUpdate

Autorelease adds the receiver to the current autorelease pool.

func (CLUpdate) Init

func (u CLUpdate) Init() CLUpdate

Init initializes the instance.

func (CLUpdate) IsStationary

func (u CLUpdate) IsStationary() bool

A Boolean value that indicates whether the device is stationary.

Discussion

Updates may stop flowing temporarily for several reasons including if the app is no longer authorized to receive location updates or if its location becomes unknown. If Core Location stops delivering updates because the device is stationary, then it sets `isStationary` to true; otherwise, it’s false.

If `isStationary` is true, then the framework can suspend updates until the person starts moving, or their location becomes unknown.

See: https://developer.apple.com/documentation/CoreLocation/CLUpdate/isStationary

func (CLUpdate) Location

func (u CLUpdate) Location() ICLLocation

A person’s location, if available.

Discussion

If the location isn’t available, the value is `nil`.

See: https://developer.apple.com/documentation/CoreLocation/CLUpdate/location

type CLUpdateClass

type CLUpdateClass struct {
	// contains filtered or unexported fields
}

func GetCLUpdateClass

func GetCLUpdateClass() CLUpdateClass

GetCLUpdateClass returns the class object for CLUpdate.

func (CLUpdateClass) Alloc

func (cc CLUpdateClass) Alloc() CLUpdate

Alloc allocates memory for a new instance of the class.

func (CLUpdateClass) Class

func (cc CLUpdateClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type CLUpdateHandler

type CLUpdateHandler = func(*CLUpdate)

CLUpdateHandler handles The block that the framework invokes with each update.

Used by:

  • [CLLocationUpdater.LiveUpdaterWithConfigurationQueueHandler]
  • [CLLocationUpdater.LiveUpdaterWithQueueHandler]

type CLVisit

type CLVisit struct {
	objectivec.Object
}

Information about the user’s location during a specific period of time.

Overview

A CLVisit object encapsulates information about places that the user has been. Visit objects are created by the system and delivered by the CLLocationManager object to its delegate after you start the delivery of events. The visit includes the location where the visit occurred and information about the arrival and departure times as relevant. You do not create visit objects directly, nor should you subclass CLVisit.

Visit objects contain as much information about the visit as possible but may not always include both the arrival and departure times. For example, when the user arrives at a location, the system may send an event with only an arrival time. When the user departs a location, the event can contain both the arrival time (if your app was monitoring visits prior to the user’s arrival) and the departure time.

Getting the location

Getting the visit duration

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLVisit

func CLVisitFromID

func CLVisitFromID(id objc.ID) CLVisit

CLVisitFromID constructs a CLVisit from an objc.ID.

Information about the user’s location during a specific period of time.

func NewCLVisit

func NewCLVisit() CLVisit

NewCLVisit creates a new CLVisit instance.

func (CLVisit) ArrivalDate

func (v CLVisit) ArrivalDate() foundation.NSDate

The approximate time at which the user arrived at the specified location.

Discussion

When the visit object does not include arrival information, this property is set to the date returned by the distantPast method of NSDate.

See: https://developer.apple.com/documentation/CoreLocation/CLVisit/arrivalDate

func (CLVisit) Autorelease

func (v CLVisit) Autorelease() CLVisit

Autorelease adds the receiver to the current autorelease pool.

func (CLVisit) Coordinate

func (v CLVisit) Coordinate() CLLocationCoordinate2D

The geographical coordinate information.

See: https://developer.apple.com/documentation/CoreLocation/CLVisit/coordinate

func (CLVisit) DepartureDate

func (v CLVisit) DepartureDate() foundation.NSDate

The approximate time at which the user left the specified location.

Discussion

When the visit object does not include departure information, this property is set to the date returned by the distantFuture method of NSDate.

See: https://developer.apple.com/documentation/CoreLocation/CLVisit/departureDate

func (CLVisit) EncodeWithCoder

func (v CLVisit) EncodeWithCoder(coder foundation.INSCoder)

func (CLVisit) HorizontalAccuracy

func (v CLVisit) HorizontalAccuracy() CLLocationAccuracy

The horizontal accuracy (in meters) of the specified coordinate.

Discussion

The latitude and longitude specified by the CLVisit.Coordinate property identify the center of the circle, and this value indicates the radius of that circle.

See: https://developer.apple.com/documentation/CoreLocation/CLVisit/horizontalAccuracy

func (CLVisit) Init

func (v CLVisit) Init() CLVisit

Init initializes the instance.

type CLVisitClass

type CLVisitClass struct {
	// contains filtered or unexported fields
}

func GetCLVisitClass

func GetCLVisitClass() CLVisitClass

GetCLVisitClass returns the class object for CLVisit.

func (CLVisitClass) Alloc

func (cc CLVisitClass) Alloc() CLVisit

Alloc allocates memory for a new instance of the class.

func (CLVisitClass) Class

func (cc CLVisitClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type DataErrorHandler

type DataErrorHandler = func(*foundation.NSData, error)

DataErrorHandler handles The completion handler to call after you start monitoring location pushes. The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.

Used by:

  • [CLLocationManager.StartMonitoringLocationPushesWithCompletion]

type ErrorHandler

type ErrorHandler = func(error)

ErrorHandler handles A closure to execute after authorization status changes. The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.

Used by:

type ICLBeacon

type ICLBeacon interface {
	objectivec.IObject

	// The UUID that the observed beacon transmitted.
	UUID() foundation.NSUUID
	// The major value that the observed beacon transmitted.
	Major() foundation.NSNumber
	// The minor value that the observed beacon transmitted.
	Minor() foundation.NSNumber

	// The relative distance to the beacon.
	Proximity() CLProximity
	// The accuracy of the proximity value, measured in meters from the beacon.
	Accuracy() CLLocationAccuracy
	// The received signal strength of the beacon, measured in decibels.
	Rssi() int

	// A timestamp representing when the beacon was observed.
	Timestamp() foundation.NSDate

	InitWithCoder(coder foundation.INSCoder) CLBeacon

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLBeacon class.

Getting the beacon identity

Determining the distance to the beacon

Getting the observation timestamp

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLBeacon

type ICLBeaconIdentityCondition

type ICLBeaconIdentityCondition interface {
	ICLCondition

	// Creates a new beacon identity condition with the identifier you specify.
	InitWithUUID(uuid foundation.NSUUID) CLBeaconIdentityCondition
	// Creates a new beacon identity condition with the identifier and major value you specify.
	InitWithUUIDMajor(uuid foundation.NSUUID, major CLBeaconMajorValue) CLBeaconIdentityCondition
	// Creates a new beacon identity condition with the identifier, and major and minor values you specify.
	InitWithUUIDMajorMinor(uuid foundation.NSUUID, major CLBeaconMajorValue, minor CLBeaconMinorValue) CLBeaconIdentityCondition

	// A universally unique identifier that represent the beacon’s identifier.
	UUID() foundation.NSUUID
	// The most significant value associated with the beacon.
	Major() foundation.NSNumber
	// The least significant value associated with the beacon.
	Minor() foundation.NSNumber
}

An interface definition for the CLBeaconIdentityCondition class.

Creating beacon identity conditions

Accessing the beacon’s properties

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconIdentityCondition

type ICLBeaconRegion

type ICLBeaconRegion interface {
	ICLRegion
}

An interface definition for the CLBeaconRegion class.

See: https://developer.apple.com/documentation/CoreLocation/CLBeaconRegion

type ICLCircularGeographicCondition

type ICLCircularGeographicCondition interface {
	ICLCondition

	// Creates a new circular geographic condition with the center point and radius you provide.
	InitWithCenterRadius(center CLLocationCoordinate2D, radius CLLocationDistance) CLCircularGeographicCondition

	// The center of the circular geographic condition.
	Center() CLLocationCoordinate2D
	// The radius of the circular geographic condition.
	Radius() CLLocationDistance
}

An interface definition for the CLCircularGeographicCondition class.

Creating a circular geographic condition

Instance properties

See: https://developer.apple.com/documentation/CoreLocation/CLCircularGeographicCondition

type ICLCircularRegion

type ICLCircularRegion interface {
	ICLRegion
}

An interface definition for the CLCircularRegion class.

See: https://developer.apple.com/documentation/CoreLocation/CLCircularRegion

type ICLCondition

type ICLCondition interface {
	objectivec.IObject

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLCondition class.

See: https://developer.apple.com/documentation/CoreLocation/CLCondition-c.class

type ICLFloor

type ICLFloor interface {
	objectivec.IObject

	// The logical floor of the building.
	Level() int

	InitWithCoder(coder foundation.INSCoder) CLFloor

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLFloor class.

Getting the floor level

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLFloor

type ICLGeocoder

type ICLGeocoder interface {
	objectivec.IObject

	// A Boolean value indicating whether the receiver is in the middle of geocoding its value.
	IsGeocoding() bool
}

An interface definition for the CLGeocoder class.

Managing geocoding requests

  • ICLGeocoder.IsGeocoding: A Boolean value indicating whether the receiver is in the middle of geocoding its value.

See: https://developer.apple.com/documentation/CoreLocation/CLGeocoder

type ICLHeading

type ICLHeading interface {
	objectivec.IObject

	// The heading (measured in degrees) relative to magnetic north.
	MagneticHeading() CLLocationDirection
	// The heading (measured in degrees) relative to true north.
	TrueHeading() CLLocationDirection
	// The maximum deviation (measured in degrees) between the reported heading and the true geomagnetic heading.
	HeadingAccuracy() CLLocationDirection

	// The geomagnetic data (measured in microteslas) for the x-axis.
	X() CLHeadingComponentValue
	// The geomagnetic data (measured in microteslas) for the y-axis.
	Y() CLHeadingComponentValue
	// The geomagnetic data (measured in microteslas) for the z-axis.
	Z() CLHeadingComponentValue

	// The time at which this heading was determined.
	Timestamp() foundation.NSDate

	InitWithCoder(coder foundation.INSCoder) CLHeading

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLHeading class.

Getting the heading values

Getting the raw heading data

  • ICLHeading.X: The geomagnetic data (measured in microteslas) for the x-axis.
  • ICLHeading.Y: The geomagnetic data (measured in microteslas) for the y-axis.
  • ICLHeading.Z: The geomagnetic data (measured in microteslas) for the z-axis.

Getting the event timestamp

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLHeading

type ICLLocation

type ICLLocation interface {
	objectivec.IObject

	// Creates a location object with the specified latitude and longitude.
	InitWithLatitudeLongitude(latitude CLLocationDegrees, longitude CLLocationDegrees) CLLocation
	// Creates a location object with the specified coordinate and altitude information.
	InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyTimestamp(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, timestamp foundation.NSDate) CLLocation
	// Creates a location object with the specified coordinate, altitude, and course information.
	InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseSpeedTimestamp(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, course CLLocationDirection, speed CLLocationSpeed, timestamp foundation.NSDate) CLLocation
	// Creates a location object with the specified coordinate, altitude, course, and accuracy information.
	InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseCourseAccuracySpeedSpeedAccuracyTimestamp(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, course CLLocationDirection, courseAccuracy CLLocationDirectionAccuracy, speed CLLocationSpeed, speedAccuracy CLLocationSpeedAccuracy, timestamp foundation.NSDate) CLLocation
	InitWithCoordinateAltitudeHorizontalAccuracyVerticalAccuracyCourseCourseAccuracySpeedSpeedAccuracyTimestampSourceInfo(coordinate CLLocationCoordinate2D, altitude CLLocationDistance, hAccuracy CLLocationAccuracy, vAccuracy CLLocationAccuracy, course CLLocationDirection, courseAccuracy CLLocationDirectionAccuracy, speed CLLocationSpeed, speedAccuracy CLLocationSpeedAccuracy, timestamp foundation.NSDate, sourceInfo ICLLocationSourceInformation) CLLocation

	// The geographical coordinate information.
	Coordinate() CLLocationCoordinate2D
	// The altitude above mean sea level associated with a location, measured in meters.
	Altitude() CLLocationDistance
	// The altitude as a height above the World Geodetic System 1984 (WGS84) ellipsoid, measured in meters.
	EllipsoidalAltitude() CLLocationDistance
	// The logical floor of the building in which the user is located.
	Floor() ICLFloor
	// The time at which this location was determined.
	Timestamp() foundation.NSDate
	// Information about the source that provides the location.
	SourceInformation() ICLLocationSourceInformation

	// The radius of uncertainty for the location, measured in meters.
	HorizontalAccuracy() CLLocationAccuracy
	// The validity of the altitude values, and their estimated uncertainty, measured in meters.
	VerticalAccuracy() CLLocationAccuracy

	// Returns the distance (measured in meters) from the current object’s location to the specified location.
	DistanceFromLocation(location ICLLocation) CLLocationDistance

	// The instantaneous speed of the device, measured in meters per second.
	Speed() CLLocationSpeed
	// The accuracy of the speed value, measured in meters per second.
	SpeedAccuracy() CLLocationSpeedAccuracy
	// The direction in which the device is traveling, measured in degrees and relative to due north.
	Course() CLLocationDirection
	// The accuracy of the course value, measured in degrees.
	CourseAccuracy() CLLocationDirectionAccuracy

	InitWithCoder(coder foundation.INSCoder) CLLocation

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLLocation class.

Creating a location object

Getting the location attributes

Getting the location accuracy

Measuring the distance between coordinates

Getting speed and course information

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLLocation

type ICLLocationManager

type ICLLocationManager interface {
	objectivec.IObject

	// A Boolean value that indicates whether a widget is eligible to receive location updates.
	IsAuthorizedForWidgetUpdates() bool
	// A value that indicates the level of location accuracy the app has permission to use.
	AccuracyAuthorization() CLAccuracyAuthorization

	// The delegate object to receive update events.
	Delegate() CLLocationManagerDelegate
	SetDelegate(value CLLocationManagerDelegate)

	// Requests the user’s permission to use location services while the app is in use.
	RequestWhenInUseAuthorization()
	// Requests the user’s permission to use location services regardless of whether the app is in use.
	RequestAlwaysAuthorization()
	// Requests permission to temporarily use location services with full accuracy and reports the results to the provided completion handler.
	RequestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletion(purposeKey string, completion ErrorHandler)
	// Requests permission to temporarily use location services with full accuracy.
	RequestTemporaryFullAccuracyAuthorizationWithPurposeKey(purposeKey string)
	// The current authorization status for the app.
	AuthorizationStatus() CLAuthorizationStatus

	// The minimum distance in meters the device must move horizontally before an update event is generated.
	DistanceFilter() CLLocationDistance
	SetDistanceFilter(value CLLocationDistance)
	// The accuracy of the location data that your app wants to receive.
	DesiredAccuracy() CLLocationAccuracy
	SetDesiredAccuracy(value CLLocationAccuracy)

	// Starts the generation of updates that report the user’s current location.
	StartUpdatingLocation()
	// Stops the generation of location updates.
	StopUpdatingLocation()
	// Requests the one-time delivery of the user’s current location.
	RequestLocation()
	// A Boolean value that indicates whether the location-manager object may pause location updates.
	PausesLocationUpdatesAutomatically() bool
	SetPausesLocationUpdatesAutomatically(value bool)
	// A Boolean value that indicates whether the app receives location updates when running in the background.
	AllowsBackgroundLocationUpdates() bool
	SetAllowsBackgroundLocationUpdates(value bool)
	// The type of activity the app expects the user to typically perform while in the app’s location session.
	ActivityType() CLActivityType
	SetActivityType(value CLActivityType)

	// Starts the generation of updates based on significant location changes.
	StartMonitoringSignificantLocationChanges()
	// Stops the delivery of location events based on significant location changes.
	StopMonitoringSignificantLocationChanges()

	// Starts the delivery of visit-related events.
	StartMonitoringVisits()
	// Stops the delivery of visit-related events.
	StopMonitoringVisits()

	// Starts the generation of updates that report the user’s current heading.
	StartUpdatingHeading()
	// Dismisses the heading calibration view from the screen immediately.
	DismissHeadingCalibrationDisplay()
	// The minimum angular change in degrees required to generate new heading events.
	HeadingFilter() CLLocationDegrees
	SetHeadingFilter(value CLLocationDegrees)
	// The device orientation to use when computing heading values.
	HeadingOrientation() CLDeviceOrientation
	SetHeadingOrientation(value CLDeviceOrientation)

	// The set of shared regions monitored by all location-manager objects.
	MonitoredRegions() foundation.INSSet
	// The largest boundary distance that can be assigned to a region.
	MaximumRegionMonitoringDistance() CLLocationDistance

	// Starts the delivery of notifications for the specified beacon constraints.
	StartRangingBeaconsSatisfyingConstraint(constraint ICLBeaconIdentityConstraint)
	// Stops the delivery of notifications for the specified beacon constraints.
	StopRangingBeaconsSatisfyingConstraint(constraint ICLBeaconIdentityConstraint)
	// The set of beacon constraints currently being tracked using ranging.
	RangedBeaconConstraints() foundation.INSSet

	// The most recently retrieved user location.
	Location() ICLLocation
	// The most recently reported heading.
	Heading() ICLHeading

	HeadingBody() CLBodyIdentifiable
	SetHeadingBody(value CLBodyIdentifiable)
}

An interface definition for the CLLocationManager class.

Determining the availability of services

Receiving data from location services

Requesting authorization for location services

Specifying distance and accuracy

Running the standard location service

Running the significant change location service

Running the visits location service

Running the heading service

Running the region-monitoring service

Performing beacon ranging

Getting recent location and heading data

Instance Properties

See: https://developer.apple.com/documentation/CoreLocation/CLLocationManager

type ICLLocationSourceInformation

type ICLLocationSourceInformation interface {
	objectivec.IObject

	// Creates an instance of location source information.
	InitWithSoftwareSimulationStateAndExternalAccessoryState(isSoftware bool, isAccessory bool) CLLocationSourceInformation

	// A Boolean value that indicates whether the system receives the location from an external accessory.
	IsProducedByAccessory() bool
	// A Boolean value that indicates whether the system generates the location using on-device software simulation.
	IsSimulatedBySoftware() bool

	InitWithCoder(coder foundation.INSCoder) CLLocationSourceInformation

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLLocationSourceInformation class.

Creating a location source information object

Identifying the source of location data

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLLocationSourceInformation

type ICLLocationUpdater

type ICLLocationUpdater interface {
	objectivec.IObject

	// Invalidates the updater.
	Invalidate()
	// Pauses the updater.
	Pause()
	// Resumes the updater.
	Resume()
}

An interface definition for the CLLocationUpdater class.

Controlling the updater

See: https://developer.apple.com/documentation/CoreLocation/CLLocationUpdater

type ICLMonitor

type ICLMonitor interface {
	objectivec.IObject

	// An array that contains all the identifiers for each condition that the monitor is monitoring.
	MonitoredIdentifiers() []string
	// The name associated with the location monitor instance.
	Name() string

	// Adds a condition to monitor with the identifier you provide.
	AddConditionForMonitoringIdentifier(condition ICLCondition, identifier string)
	// Adds a condition to monitor with the state and identifier you provide.
	AddConditionForMonitoringIdentifierAssumedState(condition ICLCondition, identifier string, state CLMonitoringState)
	// Gets the monitoring record containing the condition and most recent monitoring event for the identifier you supply, if applicable.
	MonitoringRecordForIdentifier(identifier string) ICLMonitoringRecord
	// Removes the monitoring record with the identifier from monitoring.
	RemoveConditionFromMonitoringWithIdentifier(identifier string)
}

An interface definition for the CLMonitor class.

Accessing the location monitor’s identifiers

Adding and removing conditions

See: https://developer.apple.com/documentation/CoreLocation/CLMonitor-6ynwz

type ICLMonitorConfiguration

type ICLMonitorConfiguration interface {
	objectivec.IObject

	// The block the framework calls as the event handler for the location monitor instance.
	EventHandler() CLMonitorCLMonitoringEventHandler
	// The name of the monitor instance.
	Name() string
	// The dispatch queue to bind the instance of a location monitor to.
	Queue() dispatch.Queue
}

An interface definition for the CLMonitorConfiguration class.

Instance properties

See: https://developer.apple.com/documentation/CoreLocation/CLMonitorConfiguration

type ICLMonitoringEvent

type ICLMonitoringEvent interface {
	objectivec.IObject

	// A Boolean value that indicates whether the app receives accuracy-limited location updates.
	AccuracyLimited() bool
	// A Boolean value that indicates whether the app has local authorization.
	AuthorizationDenied() bool
	// A Boolean value that indicates whether the app has system-wide authorization.
	AuthorizationDeniedGlobally() bool
	AuthorizationRequestInProgress() bool
	// A Boolean value that indicates whether the app can make authorization changes.
	AuthorizationRestricted() bool
	// A Boolean value that indicates whether the app receives location updates based on other monitoring conditions.
	ConditionLimitExceeded() bool
	// A Boolean value that indicates whether the app receives location updates based on the supported condition.
	ConditionUnsupported() bool
	// A Boolean value that indicates whether the app receives location updates because it’s insufficiently in use.
	InsufficientlyInUse() bool
	// A Boolean value that indicates whether it receives location updates based on successful persistence.
	PersistenceUnavailable() bool
	ServiceSessionRequired() bool

	// The date the event occurs.
	Date() foundation.NSDate
	// A string that represents the identifier of a monitored condition.
	Identifier() string
	// An optional instance of a condition that represents the most specific condition to that this event can apply to.
	Refinement() ICLCondition
	// The state of the condition at the time of the event.
	State() CLMonitoringState

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLMonitoringEvent class.

Event states

Event properties

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringEvent

type ICLMonitoringRecord

type ICLMonitoringRecord interface {
	objectivec.IObject

	// The condition that the framework is monitoring events for.
	Condition() ICLCondition
	// An object that contains the specifics of the most recent event.
	LastEvent() ICLMonitoringEvent

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLMonitoringRecord class.

Event properties

See: https://developer.apple.com/documentation/CoreLocation/CLMonitoringRecord

type ICLPlacemark

type ICLPlacemark interface {
	objectivec.IObject

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLPlacemark class.

See: https://developer.apple.com/documentation/CoreLocation/CLPlacemark

type ICLRegion

type ICLRegion interface {
	objectivec.IObject

	// The identifier for the region object.
	Identifier() string

	// A Boolean indicating that notifications are generated upon entry into the region.
	NotifyOnEntry() bool
	SetNotifyOnEntry(value bool)
	// A Boolean indicating that notifications are generated upon exit from the region.
	NotifyOnExit() bool
	SetNotifyOnExit(value bool)

	InitWithCoder(coder foundation.INSCoder) CLRegion

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLRegion class.

Getting the region identifier

Specifying the notification conditions

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLRegion

type ICLUpdate

type ICLUpdate interface {
	objectivec.IObject

	// A Boolean value that indicates whether the device is stationary.
	IsStationary() bool
	// A person’s location, if available.
	Location() ICLLocation

	AccuracyLimited() bool
	AuthorizationDenied() bool
	AuthorizationDeniedGlobally() bool
	AuthorizationRequestInProgress() bool
	AuthorizationRestricted() bool
	InsufficientlyInUse() bool
	LocationUnavailable() bool
	ServiceSessionRequired() bool
	Stationary() bool
}

An interface definition for the CLUpdate class.

Update properties

Instance Properties

See: https://developer.apple.com/documentation/CoreLocation/CLUpdate

type ICLVisit

type ICLVisit interface {
	objectivec.IObject

	// The geographical coordinate information.
	Coordinate() CLLocationCoordinate2D
	// The horizontal accuracy (in meters) of the specified coordinate.
	HorizontalAccuracy() CLLocationAccuracy

	// The approximate time at which the user arrived at the specified location.
	ArrivalDate() foundation.NSDate
	// The approximate time at which the user left the specified location.
	DepartureDate() foundation.NSDate

	InitWithCoder(coder foundation.INSCoder) CLVisit

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the CLVisit class.

Getting the location

Getting the visit duration

Initializers

See: https://developer.apple.com/documentation/CoreLocation/CLVisit

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL